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

id not allowed in requestbody for date/location/person annotator, but id is part of the returned clinical notes #92

Closed
thomasyu888 opened this issue Nov 23, 2020 · 4 comments
Assignees
Labels
Locked Closed by the Lock workflow

Comments

@thomasyu888
Copy link
Member

thomasyu888 commented Nov 23, 2020

Screen Shot 2020-11-23 at 3 43 42 PM

Did you want me to remove "id" from each clinical note prior to calling the restPOST?

The rest call works if I remove the "id" from the request body.

@thomasyu888 thomasyu888 changed the title id not allowed in requestbody for date annotator, but id is part of the returned clinical notes id not allowed in requestbody for date/location/person annotator, but id is part of the returned clinical notes Nov 23, 2020
@tschaffter
Copy link
Member

tschaffter commented Nov 23, 2020

Do you remember when I mentioned that I was considering creating two schemas to solve the issue where a property should be part of the input and not the output or vice versa? OpenAPI options readOnly and writeOnly intend to solve this problem in a DRY way.

The problem that you report is actually due to connexion-Flask not respecting the option readOnly and writeOnly when generating examples of request bodies. Here id is marked as readOnly and so should only be included in output objects. You can confirm this by looking at the schema of the request body where id is not included.

image

Here is what OpenApi doc says for readOnly:

Relevant only for Schema "properties" definitions. Declares the property as "read only". This means that it MAY be sent as part of a response but SHOULD NOT be sent as part of the request. If the property is marked as readOnly being true and is in the required list, the required will take effect on the response only. A property MUST NOT be marked as both readOnly and writeOnly being true. Default value is false.

Note the use of "SHOULD NOT" and not "MUST NOT" in "SHOULD NOT be sent as part of the request". This means that connexion-Flask should not throw an error if a property marked as readOnly is included in the request body.

See nlpsandbox/data-node#81

Open discussion in connexion project:
spec-first/connexion#942
spec-first/connexion#350

The solution described here as part of 942 complicates the code too much and I don't want this to confuse our developers since we provide this code as example.

@tschaffter
Copy link
Member

Open tickets for OpenAPITools/openapi-generator:
OpenAPITools/openapi-generator#4190

@thomasyu888
Copy link
Member Author

The resolution is that 'id' needs to be removed from clinical notes prior to annotation.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot added the Locked Closed by the Lock workflow label Nov 25, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Locked Closed by the Lock workflow
Projects
None yet
Development

No branches or pull requests

2 participants