Replies: 2 comments 1 reply
-
@bterlson @witemple-msft Can one of you please describe plans for template parameter constraints for more object value types? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Sorry for the delay - I think something like this should be similar to what you want? TypeSpec likes it, though the OpenAPI3 emitter isn't handling object defaults yet and I'm not sure why. Anyway, would something like this work for your use case? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on a Pydantic emitter for TypeSpec and am trying to figure out the best way to emit a default value that is an instance of another model.
The existing Python code I'm trying to replace includes class instances as default values, where the classes themselves are defined to have default values. For example:
I'm trying to determine the best way to emit something like this from TypeSpec (note that I'm happy to use TypeSpec generics instead of Python generics). Nothing I've tried seems to be valid TypeSpec. Is this possible without a custom decorator of some kind?
What I've Tried
Additional Context
My TypeSpec definitions for testing include:
The Python code I'm replacing includes:
Beta Was this translation helpful? Give feedback.
All reactions