smithy-lang / smithy-python

Smithy code generators and core modules for Python (in development)
Apache License 2.0
48 stars 10 forks source link

Generate schemas #243

Closed JordonPhillips closed 5 months ago

JordonPhillips commented 5 months ago

This adds generation for schemas.

Shapes in the prelude have static definitions which can be found in prelude.py, these also work to show what these definitions look like.

Other shapes connected to the service have their schemas generated into a single file in _private/schemas.py. I had initially played around with generating schemas onto shapes where possible (i.e. as properties on structure shapes), but it added needless complexity and made their code harder to follow.

The schemas are under _private because we don't want to encourage people to look at them outside of scope of the forthcoming serialization methods.

Trait was updated to have a default value and to just use DocumentValue to save on code size.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.