Skip to content
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

Custom primary key reference in path (API spec plugin) #18

Open
mahenzon opened this issue Oct 7, 2020 · 0 comments
Open

Custom primary key reference in path (API spec plugin) #18

mahenzon opened this issue Oct 7, 2020 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest

Comments

@mahenzon
Copy link
Contributor

mahenzon commented Oct 7, 2020

Now id field is hardcoded in API spec

@property
def param_id(self) -> dict:
return {
"in": "path",
"name": "id",
"required": True,
"type": "integer",
"format": "int32",
}

we can allow defining primary key field on the ResourceDetail subclass and check it
(for get here, and other references for param_id:)

if issubclass(resource, ResourceDetail):

get field from schema by name, create spec for it

why:

support such paths as /api/person/<string:public_id>/ where public_id is unique/pk

@mahenzon mahenzon added enhancement New feature or request good first issue Good for newcomers hacktoberfest labels Oct 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers hacktoberfest
Projects
None yet
Development

No branches or pull requests

1 participant