Repository navigation
resolves Azure/data-api-builder#2462 - #3860
Open
terdskadoosh wants to merge 2 commits into
Open
terdskadoosh wants to merge 2 commits into
terdskadoosh wants to merge 2 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Non-strict mode generates unresolved schema references, and the new test loses its data-source mappings during setup.
2 open findings
What changed in this PR
Addresses #2462 by generating DAB OpenAPI documentation using each entity’s configured data source rather than only the default source.
Changes:
- Resolve entity-specific metadata for schemas and paths.
- Skip missing metadata with diagnostic logging.
- Add a two-data-source schema test.
| File | Description |
|---|---|
| src/Service.Tests/UnitTests/OpenApiDocumentorUnitTests.cs | Adds multi-data-source schema coverage and metadata helpers. |
| src/Core/Services/OpenAPI/OpenApiDocumentor.cs | Uses per-entity metadata when generating schemas and paths. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+279
to
+280
| RuntimeConfigProvider configProvider = TestHelper.GenerateInMemoryRuntimeConfigProvider(config); | ||
| RuntimeConfig loadedConfig = configProvider.GetConfig(); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Author
|
For some reason the original commit is from my work profile and not my personal. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Why make this change?
What is this change?
Summary
Files changed (key)
src/Core/Services/OpenAPI/OpenApiDocumentor.csGetEntityMetadataProvider(RuntimeConfig runtimeConfig, string entityName)RuntimeConfigand use per-entity metadata resolutionsrc/Service.Tests/UnitTests/OpenApiDocumentorUnitTests.csCreateDocument_UsesEntitySpecificDataSourceMetadataForSchemasBehavior change
How was this tested?
Unit test added:
CreateDocument_UsesEntitySpecificDataSourceMetadataForSchemas(OpenApiDocumentorUnitTests)RuntimeConfigwith two data sources and two entities mapped to different data sources (Book->books-ds,Review->reviews-ds).ISqlMetadataProviderinstances with distinct schema shapes.documentor.CreateDocument()and asserts the generated OpenAPI JSON contains:components.schemas.Bookwith expected properties (e.g.,title)components.schemas.Reviewwith expected properties (e.g.,review_id,content)Notes:
Sample Request(s)
Example: Verify OpenAPI JSON contains schemas for entities that belong to different datasources.
Start Data API Builder with a runtime config where:
Book-> data sourcebooks-dsReview-> data sourcereviews-dsFetch the OpenAPI JSON:
curl -sS -H "Accept: application/json" http://localhost:<port>/openapi.jsonExpected (excerpt):
{ "components": { "schemas": { "Book": { /* schema with properties such as "title" */ }, "Review": { /* schema with properties such as "review_id", "content" */ } } } }