This repository was archived by the owner on Mar 18, 2019. It is now read-only.
Fill parameter name from Link object instead of using "data"#42
Open
wrsulliv wants to merge 1 commit intocore-api:masterfrom
Open
Fill parameter name from Link object instead of using "data"#42wrsulliv wants to merge 1 commit intocore-api:masterfrom
wrsulliv wants to merge 1 commit intocore-api:masterfrom
Conversation
… parameter name instead of hard-coding to "data". This is part of a proposed solution to core-api#28
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
As described by #28, the "name" field of the generated Swagger JSON is currently hard-coded to "data". When using swagger-codegen, the generated models are labeled <Data*> which breaks the reusability of the generated SDKs.
The proposed solution allows a user to set a "title" property on a view (or viewset) which is then used to generate the "name" field in this format: <Title><Action>Params.
For example, the "post" action of the following viewset will be given a name of "CommentPostParams" instead of "data".
This pull request has an associated pull request at encode/django-rest-framework#5275, both of which act to drive further discussion on #28.
Assuming views and viewsets are named <ViewName>View and <ViewSetName>ViewSet, it would also be possible to extract the view name automatically with a small code change.
Related issue: marcgibbons/django-rest-swagger#595