-
Notifications
You must be signed in to change notification settings - Fork 297
Initial Support for OpenAPI v3.0.1 description document creation #1462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
ec15ee8
Add openAPI package
seantleonard 6773bdd
Initial openapi service, controller, and mapped swagger ui viewer end…
seantleonard 33dafd3
Add runtimeconfig to openapidocumentor.
seantleonard 55a78e1
Automate Component Schema creation for Full Entity (with primary key).
seantleonard 8894daf
additional GET path documenting
seantleonard 9f2c700
add openapidoc creation at startup, refine error messages 409 and 500…
seantleonard 1488636
Consolidated code paths, reduced code verbosity/duplication. Comments.
seantleonard c783106
updated response codes and formatting of number in openapi doc.
seantleonard 81ceda1
updated openapicontroller route and updated swaggerUI uri to point to…
seantleonard accb50e
Remove swagger package, keep swaggerui.
seantleonard 63f0b95
added constants and new suberrorcode.
seantleonard ca3ca2d
Merge branch 'main' into dev/seantleonard/openapiv3_initial
seantleonard 2c25653
updated media type set as application/json for GET endpoint. updated …
seantleonard 93bebc8
prevent entities from being openapi documented if they explicitly dis…
seantleonard 3489ff9
Consolidated code paths, reduced code verbosity/duplication. Comments…
seantleonard ab5d9de
Merge branch 'main' into dev/seantleonard/openapiv3_initial
seantleonard 9941fb7
Moved placement of swaggerUI setup, to fix HTTP400 errors
seantleonard 058c53d
Remove ability to POST on openapicontroller since creation occurs on …
seantleonard 12d25fb
remove unnecessary usings
seantleonard e79f905
updated comments to correctly reflect operations and expected results.
seantleonard 28b4120
updating function comments in interface, updating documentor usage of…
seantleonard dbcf3b5
Merge branch 'main' into dev/seantleonard/openapiv3_initial
seantleonard cf7fbe3
updated custom REST route handling for swagger and openapi, moved ope…
seantleonard 988faaf
updated with dotnet format.
seantleonard de2026f
fixed tests and controller logic
seantleonard f1e06b9
list to hashset to track columns
seantleonard f77b304
allow building notice file in dev.
seantleonard aaaee4d
allow building notice file remove conditions.
seantleonard 69c5fb0
Merge branch 'main' into dev/seantleonard/openapiv3_initial
abhishekkumams d30b776
Merge branch 'main' into dev/seantleonard/openapiv3_initial
seantleonard 32da9c4
updated tests, updated restservice/controller handling of swaggerendp…
seantleonard 6aee930
added back condition to notice file generation task in ci/cd pipeline
seantleonard d25b15b
updated logic and tests for RestPath retrieval to use existing functions
seantleonard dd3ead5
reuse constants for default rest path /api
seantleonard 834615d
updated hashset name to nonAutoGeneratedPKColumnNames
seantleonard b05b812
Merge branch 'main' into dev/seantleonard/openapiv3_initial
seantleonard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Large diffs are not rendered by default.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/Service.Tests/OpenApiDocumentor/OpenApiDocumentorConstants.cs
This file contains hidden or 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,15 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Azure.DataApiBuilder.Service.Tests | ||
| { | ||
| public class OpenApiDocumentorConstants | ||
| { | ||
| public const string TOPLEVELPROPERTY_OPENAPI = "openapi"; | ||
| public const string TOPLEVELPROPERTY_INFO = "info"; | ||
| public const string TOPLEVELPROPERTY_SERVERS = "servers"; | ||
| public const string TOPLEVELPROPERTY_PATHS = "paths"; | ||
| public const string TOPLEVELPROPERTY_COMPONENTS = "components"; | ||
| public const string PROPERTY_SCHEMAS = "schemas"; | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,31 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Azure.DataApiBuilder.Service.Services.OpenAPI | ||
| { | ||
| /// <summary> | ||
| /// Interface for the service which generates and provides the OpenAPI description document | ||
| /// describing the DAB engine's entity REST endpoint paths. | ||
| /// </summary> | ||
| public interface IOpenApiDocumentor | ||
| { | ||
| /// <summary> | ||
| /// Attempts to return the OpenAPI description document, if generated. | ||
| /// </summary> | ||
| /// <param name="document">String representation of JSON OpenAPI description document.</param> | ||
| /// <returns>True (plus string representation of document), when document exists. False, otherwise.</returns> | ||
| public bool TryGetDocument([NotNullWhen(true)] out string? document); | ||
|
|
||
| /// <summary> | ||
| /// Creates an OpenAPI description document using OpenAPI.NET. | ||
| /// Document compliant with patches of OpenAPI V3.0 spec 3.0.0 and 3.0.1, | ||
| /// aligned with specification support provided by Microsoft.OpenApi. | ||
| /// </summary> | ||
| /// <exception cref="DataApiBuilderException">Raised when document is already generated | ||
| /// or a failure occurs during generation.</exception> | ||
| /// <seealso cref="https://github.com/microsoft/OpenAPI.NET/blob/1.6.3/src/Microsoft.OpenApi/OpenApiSpecVersion.cs"/> | ||
| public void CreateDocument(); | ||
| } | ||
| } |
This file contains hidden or 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,42 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Azure.DataApiBuilder.Service.Services.OpenAPI | ||
| { | ||
| /// <summary> | ||
| /// Specifies the data type of a JSON value. | ||
| /// Distinguished from System.Text.Json enum JsonValueKind because there are no separate | ||
| /// values for JsonValueKind.True or JsonValueKind.False, only a single value JsonDataType.Boolean. | ||
| /// This distinction is necessary to facilitate OpenAPI schema creation which requires generic | ||
| /// JSON types to be defined for parameters. Because no values are present, JsonValueKind.True/False | ||
| /// can't be used. | ||
| /// </summary> | ||
| public enum JsonDataType | ||
| { | ||
| Undefined = 0, | ||
| /// <summary> | ||
| /// A JSON Object | ||
| /// </summary> | ||
| Object = 1, | ||
| /// <summary> | ||
| /// A JSON array | ||
| /// </summary> | ||
| Array = 2, | ||
| /// <summary> | ||
| /// A JSON string | ||
| /// </summary> | ||
| String = 3, | ||
| /// <summary> | ||
| /// A JSON number | ||
| /// </summary> | ||
| Number = 4, | ||
| /// <summary> | ||
| /// A JSON Boolean | ||
| /// </summary> | ||
| Boolean = 5, | ||
| /// <summary> | ||
| /// The JSON value null | ||
| /// </summary> | ||
| Null = 6 | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.