Add ModelTypeMap for GraphQL object type materialization#58
Open
FionaBronwen wants to merge 2 commits intofionabronwen/enum-typemapfrom
Open
Add ModelTypeMap for GraphQL object type materialization#58FionaBronwen wants to merge 2 commits intofionabronwen/enum-typemapfrom
FionaBronwen wants to merge 2 commits intofionabronwen/enum-typemapfrom
Conversation
54b3fd9 to
e842ba5
Compare
ca5538e to
cee34c5
Compare
e842ba5 to
2400d78
Compare
cee34c5 to
f7a355e
Compare
2400d78 to
964a436
Compare
f7a355e to
fc918d4
Compare
a0c840c to
f410002
Compare
fc918d4 to
5161de0
Compare
5652caa to
463b824
Compare
5161de0 to
1f6dff6
Compare
463b824 to
398ae95
Compare
1f6dff6 to
9613d6a
Compare
398ae95 to
1704900
Compare
9613d6a to
1e07021
Compare
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.
Summary
Introduces
ModelTypeMapfor converting TypeSpec Models to GraphQL types, integrates it with the registry, and wires up the schema emitter to register and materialize models.Changes
ModelTypeMap (
src/type-maps/model.ts):TypeMap<Model, GraphQLObjectType | GraphQLInputObjectType>GraphQLObjectTypefor output types,GraphQLInputObjectTypefor input types during model materializationusageFlaginTSPContextto determine which type to createmapPropertyType()for future type resolutionRegistry (
src/registry.ts):modelTypeMapalongsideenumTypeMapaddModel(model, usageFlag)- registers a model with usage contextmaterializeModel(name)- lazily materializes to GraphQL typematerializeSchemaConfig()now includes models in outputSchema emitter (
src/schema-emitter.ts):modelhandler callsregistry.addModel()exitModelhandler callsregistry.materializeModel()Example output
Note: All fields map to String as placeholder - full model property type mapping is TODO.