-
Notifications
You must be signed in to change notification settings - Fork 7
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
2714 custom fields #2757
2714 custom fields #2757
Conversation
try: | ||
req = request.get_json() | ||
schema_controller.add_field(req["name"], req["type"], req["description"]) | ||
return "", 201 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except ConflictError
returns 409, except PreconditionUnsatisfiedError
returns 400,
and except KeyError
returns 400?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so KeyError
shouldn't happen: that will come from Field.model_type
if you try to use a field type that isn't in the allowed list. So we turn it into PreconditionUnsatisfiedError
which is the same as when we explicitly check that the type isn't found in the allowed list: i.e. both exception paths mean the same thing so they result in the same error (400 bad request: you've asked for something we aren't going to let you do).
ConflictError
does indeed result in a 409 Conflict status.
This is the first part of extending the model in the data service with additional fields: adding those fields and storing descriptions in the DB. Still to come: