-
Notifications
You must be signed in to change notification settings - Fork 299
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 12 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
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,67 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Azure.DataApiBuilder.Service.Exceptions; | ||
| using Azure.DataApiBuilder.Service.Services; | ||
| using Microsoft.AspNetCore.Mvc; | ||
|
|
||
| namespace Azure.DataApiBuilder.Service.Controllers | ||
| { | ||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| [Route("[controller]")] | ||
| [ApiController] | ||
| public class OpenApiController : ControllerBase | ||
| { | ||
| private IOpenApiDocumentor _apiDocumentor; | ||
|
|
||
| public OpenApiController(IOpenApiDocumentor openApiDocumentor) | ||
| { | ||
| _apiDocumentor = openApiDocumentor; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <returns></returns> | ||
| [HttpGet] | ||
| public IActionResult Get() | ||
| { | ||
| return _apiDocumentor.TryGetDocument(out string? document) ? Ok(document) : NotFound(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// | ||
| /// </summary> | ||
| /// <returns></returns> | ||
| [HttpPost] | ||
| public IActionResult Post() | ||
| { | ||
| try | ||
| { | ||
| _apiDocumentor.CreateDocument(); | ||
|
|
||
| if (_apiDocumentor.TryGetDocument(out string? document)) | ||
| { | ||
| return new CreatedResult(location:"/openapi" ,value: document); | ||
| } | ||
|
|
||
| return NotFound(); | ||
| } | ||
| catch (DataApiBuilderException dabException) | ||
| { | ||
| Response.StatusCode = (int)dabException.StatusCode; | ||
| return new JsonResult(new | ||
| { | ||
| error = new | ||
| { | ||
| code = dabException.SubStatusCode.ToString(), | ||
| message = dabException.Message, | ||
| status = (int)dabException.StatusCode | ||
| } | ||
| }); | ||
| } | ||
| } | ||
| } | ||
| } |
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,13 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Azure.DataApiBuilder.Service.Services | ||
| { | ||
| public interface IOpenApiDocumentor | ||
| { | ||
| public bool TryGetDocument([NotNullWhen(true)] out string? document); | ||
| public void CreateDocument(); | ||
| } | ||
| } |
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.