-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7e05d6a
commit 197f4e4
Showing
12 changed files
with
538 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
28 changes: 28 additions & 0 deletions
28
internal/converter/testdata/trim_unused_type/has_unused.proto
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Protobuf that flexes a lot of the types | ||
syntax = "proto3"; | ||
|
||
package has_unused_types; | ||
|
||
import "google/protobuf/empty.proto"; | ||
|
||
// This service tries to flex the different options | ||
service FlexService { | ||
// Normal RPC method | ||
rpc NormalRPC(UsedRequest) returns (UsedReply) {} | ||
} | ||
|
||
message UsedRequest { | ||
UsedType msg = 1; | ||
} | ||
|
||
message UsedReply { | ||
UsedType msg = 1; | ||
} | ||
|
||
message UsedType { | ||
string description = 1; | ||
} | ||
|
||
message Unused { | ||
string unused_field = 1; | ||
} |
180 changes: 180 additions & 0 deletions
180
internal/converter/testdata/trim_unused_type/output/has_unused.openapi.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
{ | ||
"openapi": "3.1.0", | ||
"info": { | ||
"title": "has_unused_types" | ||
}, | ||
"paths": { | ||
"/has_unused_types.FlexService/NormalRPC": { | ||
"post": { | ||
"tags": [ | ||
"has_unused_types.FlexService" | ||
], | ||
"summary": "NormalRPC", | ||
"description": "Normal RPC method", | ||
"operationId": "has_unused_types.FlexService.NormalRPC", | ||
"parameters": [ | ||
{ | ||
"name": "Connect-Protocol-Version", | ||
"in": "header", | ||
"required": true, | ||
"schema": { | ||
"$ref": "#/components/schemas/connect-protocol-version" | ||
} | ||
}, | ||
{ | ||
"name": "Connect-Timeout-Ms", | ||
"in": "header", | ||
"schema": { | ||
"$ref": "#/components/schemas/connect-timeout-header" | ||
} | ||
} | ||
], | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/has_unused_types.UsedRequest" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"default": { | ||
"description": "Error", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/connect.error" | ||
} | ||
} | ||
} | ||
}, | ||
"200": { | ||
"description": "Success", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/has_unused_types.UsedReply" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"has_unused_types.UsedReply": { | ||
"type": "object", | ||
"properties": { | ||
"msg": { | ||
"$ref": "#/components/schemas/has_unused_types.UsedType" | ||
} | ||
}, | ||
"title": "UsedReply", | ||
"additionalProperties": false | ||
}, | ||
"has_unused_types.UsedRequest": { | ||
"type": "object", | ||
"properties": { | ||
"msg": { | ||
"$ref": "#/components/schemas/has_unused_types.UsedType" | ||
} | ||
}, | ||
"title": "UsedRequest", | ||
"additionalProperties": false | ||
}, | ||
"has_unused_types.UsedType": { | ||
"type": "object", | ||
"properties": { | ||
"description": { | ||
"type": "string", | ||
"title": "description" | ||
} | ||
}, | ||
"title": "UsedType", | ||
"additionalProperties": false | ||
}, | ||
"connect-protocol-version": { | ||
"type": "number", | ||
"title": "Connect-Protocol-Version", | ||
"enum": [ | ||
1 | ||
], | ||
"description": "Define the version of the Connect protocol", | ||
"const": 1 | ||
}, | ||
"connect-timeout-header": { | ||
"type": "number", | ||
"title": "Connect-Timeout-Ms", | ||
"description": "Define the timeout, in ms" | ||
}, | ||
"connect.error": { | ||
"type": "object", | ||
"properties": { | ||
"code": { | ||
"type": "string", | ||
"examples": [ | ||
"CodeNotFound" | ||
], | ||
"enum": [ | ||
"CodeCanceled", | ||
"CodeUnknown", | ||
"CodeInvalidArgument", | ||
"CodeDeadlineExceeded", | ||
"CodeNotFound", | ||
"CodeAlreadyExists", | ||
"CodePermissionDenied", | ||
"CodeResourceExhausted", | ||
"CodeFailedPrecondition", | ||
"CodeAborted", | ||
"CodeOutOfRange", | ||
"CodeInternal", | ||
"CodeUnavailable", | ||
"CodeDataLoss", | ||
"CodeUnauthenticated" | ||
], | ||
"description": "The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]." | ||
}, | ||
"message": { | ||
"type": "string", | ||
"description": "A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client." | ||
}, | ||
"detail": { | ||
"$ref": "#/components/schemas/google.protobuf.Any" | ||
} | ||
}, | ||
"title": "Connect Error", | ||
"additionalProperties": true, | ||
"description": "Error type returned by Connect: https://connectrpc.com/docs/go/errors/#http-representation" | ||
}, | ||
"google.protobuf.Any": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string" | ||
}, | ||
"value": { | ||
"type": "string", | ||
"format": "binary" | ||
}, | ||
"debug": { | ||
"type": "object", | ||
"additionalProperties": true | ||
} | ||
}, | ||
"additionalProperties": true, | ||
"description": "Contains an arbitrary serialized message along with a @type that describes the type of the serialized message." | ||
} | ||
} | ||
}, | ||
"security": [], | ||
"tags": [ | ||
{ | ||
"name": "has_unused_types.FlexService", | ||
"description": "This service tries to flex the different options" | ||
} | ||
] | ||
} |
Oops, something went wrong.