-
Notifications
You must be signed in to change notification settings - Fork 8
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
Feature openapi3 #479
Feature openapi3 #479
Conversation
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.
I think this is on the right track. Down with swagger, up with OpenAPI.
This endpoint can be used with the Content-Type: application/json and uses the `CLKUpload` | ||
structure of a JSON array of base64 encoded strings. | ||
|
||
### Binary Upload |
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.
Binary uploads using the existing endpoint will still be supported? If not this section can now be removed
'503': | ||
$ref: '#/components/responses/RateLimited' | ||
|
||
'/projects/{project_id}/binaryclks': |
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.
If you're feeling really brave you could setup nginx to inspect requests to POST /clks
and if they have Content-Type: application/octet-stream
send the request here.
description: Base64 encoded CLK data | ||
|
||
CLKnBlockUpload: | ||
description: Array of this party's Bloom Filters |
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.
Suggest adding more detail describing this object either in the endpoint docs, or the description here.
# TODO actually stream the upload data straight to Minio. Currently we can't because | ||
# connexion has already read the data before our handler is called! | ||
# https://github.com/zalando/connexion/issues/592 | ||
# stream = get_stream() |
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.
shame this hasn't been fixed :-/
Another connexion weirdness: I defined the CLKnBlocks upload like this:
connexion is not impressed though:
If I simplify the definition to this:
it works. However, this definition is not as clean, as it does not require to have either clk or block info. |
OK, I officially declare this branch ready for review. Main work:
|
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.
Good to merge, but I have a few suggestions & questions inline.
@@ -3,7 +3,7 @@ bitmath==1.3.1.2 | |||
celery==4.4.0 | |||
clkhash==0.15.1 | |||
colorama==0.4.1 # required for structlog | |||
connexion[swagger-ui]==2.6 | |||
connexion==2.6.0 |
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.
I thought we saw warnings logged if we didn't include swagger-ui
?
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.
two options:
- disable swagger-ui.
con_app.add_api(pathlib.Path("openapi.yaml"),
base_path='/',
options={'swagger_ui': False},
strict_validation=config.CONNEXION_STRICT_VALIDATION,
validate_responses=config.CONNEXION_RESPONSE_VALIDATION)
- use swagger_ui. For this, we have to solve two problems. First the default url to the spec is not working in our case.
con_app.add_api(pathlib.Path("openapi.yaml"),
base_path='/',
options={'swagger_ui_config': {'url': '/api/v1/openapi.json'}},
strict_validation=config.CONNEXION_STRICT_VALIDATION,
validate_responses=config.CONNEXION_RESPONSE_VALIDATION)
Yay. Secondly, connexion removes the server description/url. (See above) Therefore you cannot actually use the UI to hit the endpoints.
Because 2 doesn't work, I favor 1.
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.
Also in favor of option 1 👍
name: 'Confidential Computing, Data61 | CSIRO' | ||
email: [email protected] | ||
description: >- | ||
Allows two organisations to carry out private record linkage - |
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.
Allows two organisations to carry out private record linkage - | |
Allows multiple organisations to carry out private record linkage - |
`project_id` and a valid `upload_token` in order to contribute data. | ||
|
||
The data uploaded must be of one of the following formats. | ||
- CLKs only upload: An array of base64 encoded CLKs (./concepts.html#cryptographic-longterm-keys), one per |
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.
Use markdown for the link
tags: | ||
- Project | ||
description: | | ||
An experimental api has been added for uploading CLKs as a binary file. This is to allow for |
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.
An experimental api has been added for uploading CLKs as a binary file. This is to allow for | |
An experimental api for uploading CLKs as a binary file. This is to allow for |
description: Base64 encoded CLK data | ||
|
||
CLKnBlockUpload: | ||
description: Array of this party's Bloom Filters including blocking information |
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.
This is an object containing a single element which is an array. Do we need/want the extra layer just so you can say clknblocks
?
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.
With the clks only, we upload a json of the form {"clks": [...]}.
Therefore I thought that for better separation, we will give the new format a new key.
That simplifies figuring out the format on the receiving end.
I also like to have the clks under a key and not top level, such that we can easily add meta info without breaking anything.
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.
It would still be nice for the description to be accurate - i.e. object
rather than Array
ok, this all started with me wanting to extend the clk upload endpoint to alternatively accept clk'n'blocks.
I think that the
oneOf
operator would be nice and elegant. However, this is only supported from openapi 3 onwards.In version 3, the clks endpoint would then look like this:
Unfortunately, connexion is not helping.
Currently, if an endpoint is defined to accept more than one kind of content types, connexion
ignores this information and assumes that they are all
application/json
. See for instance here.There is some work in progress that started in 2018 to address this.
So for now, I addressed this by creating a separate endpoint (binaryclks) to accept the binary format.
Another annoyance: I added the swaggerUI, thought that would be handy to play with, and read about the api. Unfortunately, connexion does some magic to the
servers
definition in the api spec such that (in our case) they disappear.Can you have a look at this so far and tell me what you think?