-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix reference creation when two types are provided (#756)
Previously the type from param definition would be used to documentation even if we try to override it in the `documentation` hash. It caused Swagger UI to render, for example, "Unknown Type: Color" instead of using the provided entity. It terms of code, before this change we would return something like this: { color: { type: 'Color' } instead of: { color: { '$ref' => 'ColorEntity' } if Color is not inherited from Grape::Entity Having different types can be useful when two different classes are used for parsing and presenting an attribute. E.g. the input format for Base64 File can be represented as a Hash (content, content_type and filename), whereas the type after parsing can be ActionDispatch::Http::UploadedFile. In the current situation the solution to this problem is to put coercion methods to the same entity and specify `type` only for the param without using `documentation`.
- Loading branch information
Showing
3 changed files
with
37 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters