Move schema store into service and add schema keys #56084
Merged
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.
This pull request renames the
OpenApiComponentService
toOpenApiSchemaService
and introducesOpenApiSchemaStore
service to support managing the storage/retrieval of schemas in the cache. It also introduces anOpenApiSchemaKey
type to support referencing keys in the schema.Key Changes:
src/OpenApi/src/Extensions/OpenApiServiceCollectionExtensions.cs
: ReplacedOpenApiComponentService
withOpenApiSchemaService
and addedOpenApiSchemaStore
in theAddOpenApiCore
method.src/OpenApi/src/Services/OpenApiDocumentService.cs
: ReplacedOpenApiComponentService
withOpenApiSchemaService
.src/OpenApi/src/Services/Schemas/OpenApiSchemaService.cs
: Renamed fromOpenApiComponentService.cs
, refactored to useOpenApiSchemaStore
andOpenApiSchemaKey
. [1] [2] [3] [4]src/OpenApi/src/Services/Schemas/OpenApiSchemaStore.cs
: New class to store schemas generated by the JsonSchemaMapper for a given OpenAPI document for later resolution.src/OpenApi/src/Services/Schemas/OpenApiSchemaKey.cs
: New record struct introduced to represent a unique identifier for storing and retrieving JSON schemas.src/OpenApi/test/Extensions/OpenApiServiceCollectionExtensionsTests.cs
: Updated the assertions to check forOpenApiSchemaService
instead ofOpenApiComponentService
. [1] [2] [3] [4] [5] [6]src/OpenApi/test/Services/OpenApiDocumentServiceTestsBase.cs
: Updated theTestServiceProvider
class to useOpenApiSchemaService
andOpenApiSchemaStore
, and updated theGetKeyedService
andGetRequiredKeyedService
methods accordingly. [1] [2]