-
Notifications
You must be signed in to change notification settings - Fork 230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expression forms for declarations #189
Comments
|
I looked at this a bit and I don't think the impact to error recovery is at all enough to stop this proposal from going forward. There will be some work and slight experience differences, like thinking a missing |
As part of this, make sure we think about naming expression forms, see: https://github.com/Azure/cadl-azure/issues/1025 |
It's kind of hard to follow all the discussion around the topic of extensible enums. What would actually be generated for those extensible properties? I've seen mentioned a few times the For example there is the "zalando" way of doing it like this, which is what I would like to do:
There is an ongoing discussion in the OpenAPI specification about this topic. Maybe some comments in there could be a good inspiration for what people are currently using to define extensible enums, and it would be great if at least a few of the more common ones could be achieved with cadl. |
We have a need for passing enums to decorators to support the "extensible enum" pattern - a value that is effectively a string or number, but which has some known and documented values. Passing an enum expression to a decorator is a convenient way to achieve this.
All of our current declarations may have similar use cases, and anyway being consistent about allowing expression forms for declarations seems like a good thing.
Semantically, expression forms are not declarations, but may still be named. This ensures that declarations which introduce bindings are still easily visible (and not affected by deeply nested expressions).
Example syntax:
Potential issues:
Foo
example above will likely result in a schema for a modelBar
. This may be problematic because finding the actual source for this declaration may be difficult.The text was updated successfully, but these errors were encountered: