Openapi generated client - #125
Conversation
Codecov Report
@@ Coverage Diff @@
## develop_active_learning #125 +/- ##
===========================================================
- Coverage 82.00% 81.87% -0.13%
===========================================================
Files 58 56 -2
Lines 1800 1788 -12
===========================================================
- Hits 1476 1464 -12
Misses 324 324
Continue to review full report at Codecov.
|
philippmwirth
left a comment
There was a problem hiding this comment.
Please correct me if I'm wrong.
In my understanding, the following points hold:
- We have a part of this repo in our repo
- Everytime we build the api from scratch, we also need to make changes to
tag_data.pyandmodel.mustache
If so, please make changes such that the necessary code from the other repo is not part of our repository. Instead, give instructions on how to get the required code or clone it automatically in the generator script. Also, can we apply the necessary changes to the two files as a patch or similar?
Let me know if anything is unclear.
|
|
||
| # install swagger-codegen following the instructions at https://github.com/swagger-api/swagger-codegen#compatibility | ||
| swagger-codegen generate -l python -i $PATH_TO_SPEC -o lightly/openapi_generated --template-dir openapi_client_generator/python --template-engine mustache | ||
|
|
There was a problem hiding this comment.
I don't think we should have the openapi_client_generator code as part of our repository..
There are two options which I would prefer:
- Add a line to this script which clones the generator repo at a specified commit
- Describe in the README how someone who wants to build the package from scratch can clone the repo and then set the path
| six >= 1.10 | ||
| python_dateutil >= 2.5.3 | ||
| setuptools >= 21.0.0 | ||
| urllib3 >= 1.15.1 |
There was a problem hiding this comment.
This introduces new requirements, they should be specified in the PIP package requirements.
| _return_http_data_only=params.get('_return_http_data_only'), | ||
| _preload_content=params.get('_preload_content', True), | ||
| _request_timeout=params.get('_request_timeout'), | ||
| collection_formats=collection_formats) |
There was a problem hiding this comment.
What do we need the annotations api for?
| _return_http_data_only=params.get('_return_http_data_only'), | ||
| _preload_content=params.get('_preload_content', True), | ||
| _request_timeout=params.get('_request_timeout'), | ||
| collection_formats=collection_formats) |
There was a problem hiding this comment.
I'm pretty sure that this code should not be public. Can you remove all the generated API code which is not being used?
| if not isinstance(other, AnnotationState): | ||
| return True | ||
|
|
||
| return self.to_dict() != other.to_dict() |
There was a problem hiding this comment.
All the annotation data / requests are not needed by the PIP package, or am I wrong?
| if not isinstance(other, CreateCFBucketActivityRequest): | ||
| return True | ||
|
|
||
| return self.to_dict() != other.to_dict() |
There was a problem hiding this comment.
This is not needed in the PIP package
| {{/nullable}} | ||
| {{/required}} | ||
| {{#isEnum}} | ||
| {{#isContainer}} |
There was a problem hiding this comment.
Ok do we have to change this everytime we generate the API code? In that case I would make an additional change in the generate_openapi_client.sh script which applies this as a patch.
|
@philippmwirth:
|
Yes, this is pretty accurate. Only one thing: I don't think it would be such a good idea to put the generator in the lightly-core repo. Can we not simply clone the code and apply the changes with a patch? My guess is we could write a script which retrieves the code, applies the patch, and then generates the openapi code. |
24f6766 to
bde4a85
Compare
PR consist of following steps / commits:
openapi_client_generator/python/openapi_client_generator/generate_openapi_client.sh-> should be testedlightly/openapi_generated/