-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add operation docs to OpenAPI conversion
- Loading branch information
Showing
4 changed files
with
110 additions
and
0 deletions.
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
54 changes: 54 additions & 0 deletions
54
.../test/resources/software/amazon/smithy/openapi/fromsmithy/documentation-test.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,54 @@ | ||
{ | ||
"openapi": "3.0.2", | ||
"info": { | ||
"title": "MyDocs", | ||
"version": "2018-01-01", | ||
"description": "Service" | ||
}, | ||
"paths": { | ||
"/": { | ||
"get": { | ||
"description": "Operation", | ||
"operationId": "MyDocsOperation", | ||
"responses": { | ||
"200": { | ||
"description": "MyDocsOperation 200 response", | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/MyDocsOperationResponseContent" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"MyDocsOperationResponseContent": { | ||
"type": "object", | ||
"description": "Output", | ||
"properties": { | ||
"foo": { | ||
"type": "string", | ||
"description": "foo member." | ||
}, | ||
"nested": { | ||
"$ref": "#/components/schemas/Nested" | ||
} | ||
} | ||
}, | ||
"Nested": { | ||
"type": "object", | ||
"description": "Nested", | ||
"properties": { | ||
"baz": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...pi/src/test/resources/software/amazon/smithy/openapi/fromsmithy/documentation-test.smithy
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,34 @@ | ||
namespace smithy.example | ||
|
||
/// Service | ||
@aws.protocols#restJson1 | ||
service MyDocs { | ||
version: "2018-01-01", | ||
operations: [MyDocsOperation] | ||
} | ||
|
||
/// Operation | ||
@http(method: "GET", uri: "/") | ||
@readonly | ||
operation MyDocsOperation { | ||
output: Output | ||
} | ||
|
||
/// Output | ||
structure Output { | ||
/// foo member. | ||
foo: String, | ||
|
||
/// Note: these member docs are ignored and instead only the documentation | ||
/// on the targeted structure is present in the output. This is because our | ||
/// users have told us that it's more important to reuse structure definitions | ||
/// than it is to have 100% fidelity with the original Smithy model. In a | ||
/// previous implementation, we created a unique named shape for every member, | ||
/// but this results in no shape reuse across the generated OpenAPI model. | ||
nested: Nested, | ||
} | ||
|
||
/// Nested | ||
structure Nested { | ||
baz: String, | ||
} |