Feature/support metadata from swagger request #811
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.
This PR introduces a powerful new pattern that allows Chopper interceptors to access the data of our API Swagger request
We've created a SwaggerMetaData class that carries endpoint-specific details—like security schemes and tags—and injects this data into the request lifecycle using Chopper's @Tag() feature.
Motivation
Previously, our interceptors operated with limited context. An AuthInterceptor, for example, had no easy way to know if a specific endpoint required authentication, often leading to brittle logic that applied headers to all requests. This change allows us to build smarter, context-aware interceptors that act based on the endpoint's formal definition.
Implementation
The code generator now creates a SwaggerMetaData object for each API method, populated with data from the Swagger spec. This object is passed as a tag, making it available within any interceptor.
This enables cleaner, more reliable logic. For instance, the AuthInterceptor can now simply check if the endpoint's metadata includes the BearerAuth security requirement before attaching a token.