Skip to content

Decouple bigautofield #5011

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

Closed
wants to merge 2 commits into from

Conversation

dczech
Copy link

@dczech dczech commented Mar 21, 2017

Description

refs #5007, fixes #5006
This pull requests solves the specific issue,could not have been solved in other way. There is a hardcoded constraint in documentation API which require all AutoField descendants to be entered as integer field. For BigAutoField field I have a case, where I can't use it, because large id numbers are rounded to fit the javascript mantissa range (<2^53)

@tomchristie
Copy link
Member

I don't think we can run with this.
If you want to go outside the interop and use the API docs with that, then yes, you need to customize the schema generation. (I don't think having string by default for BigAutoField is going to be acceptable as the default tho.)

Addressing #5007 would at least error loudly when you hit this case. We could also put a "max_value" on the schema field, which, if we validated it in the interaction form would prevent the request from being made in the first place.

@dczech
Copy link
Author

dczech commented Mar 21, 2017

@tomchristie The question is: why is AutoField so special that it needs special treatment in documentation API? Serializers make great work there and validation should rely on them and not on hardcoded magic. And the worst thing that it is the "magic" which cannot be easily adjusted.

Maybe I don't see all the reasons behind this design , but this change has only impact on documentation API and event removing the hardwired mapping between AutoField and integer would be better then restricting valid values of BigAutoField (I think there were some reasons why this type was created). IMO this is a bug not a feature.

Sorry for my English.

@tomchristie
Copy link
Member

There's nothing "special" about autofield/bigautofield, it's just that they are integers, and our API schemas should represent them as such.

(With the edge-case exception of folks who need to operate outside the tremendously large interop range, that JSON cannot handle.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BigAutoField should be serialized as string instead of int
2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy