-
Notifications
You must be signed in to change notification settings - Fork 91
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
Rename request and response types #375
Conversation
Having played a bit with this PR in my IDE, and after a bit of thinking, I'm not sure renaming everything to just I'm using IntelliJ as my IDE. Navigating to a particular declaration can be done in 3 ways: by searching for a symbol, by searching by a file name, of by navigating the tree. The latter is much slower as it requires either the mouse or lots of arrow keystrokes. Renaming all requests and responses to just So what about letting spec writers use a naming of their choosing for endpoint request and response, that is meaningful in the context of a namespace? I actually would go as far as enforcing uniqueness in a namespace, i.e. extend the uniqueness constraint we have defined for This allows code generators to flatten all identifiers of a namespace into a single module if they want, without having to implement a scheme to create unique names for requests and responses. And if we don't want to allow free-form naming, we can also enforce a convention that requires request and response names to be prefixed by the endpoint name (without the namespace), e.g. |
Wasn't that what we agreed on in the first place? Otherwise, we'll struggle to have any language idiomatic's. The spec yield should sufficient already to make the call on defining custom naming patterns for request & response. |
I'm not sure what you mean, with VSCode if I do cmd+click on an imported definition with a import alias, I get the original definition as expected.
This is exactly what we had before refactoring the spec with the rest-api-spec namespaces, and it was causing issues down the road. This new strategy is stricter and won't allow any inconsistency with naming. For example:
Since we are guaranteeing name uniqueness within a folder, a language generator could create the type in any way the target language needs. It can be a deep namespaced import, eg Finally, I don't believe that the tree navigation is slow, in my opinion is "fast" as it's very straightforward, even for newcomers. For example, you need the cluster health request definition, you know already where it is, 3 clicks away! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
As titled.
TODO: