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

ci: Validation of OpenAPI files using GitHub Actions #6

Draft
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

teolemon
Copy link
Member

@teolemon teolemon commented May 7, 2021

  • Installs Python, dependancies, a PostGre instance
  • Find out how to generate the OpenAPI file from the source code
  • Runs the Test Suite (tests are failing, probably because of bad config of the postgre instance)
  • Validation of OpenAPI files using GitHub Actions
  • EXTRA: find out how to generate SDKs from the source code

What db name, user and pass should I use ? Any tip to make the tests green ?

Sorry, something went wrong.

Verified

This commit was signed with the committer’s verified signature.
falkTX Filipe Coelho
gha-validation
@teolemon teolemon changed the title gha-validation Validation of OpenAPI files using GitHub Actions May 7, 2021
@teolemon teolemon marked this pull request as draft May 7, 2021 07:57
@teolemon teolemon changed the title Validation of OpenAPI files using GitHub Actions [WIP] Validation of OpenAPI files using GitHub Actions May 7, 2021
@cquest
Copy link
Collaborator

cquest commented May 7, 2021

Documentation and the openapi file are generated live by the API itself.

https://api.folksonomy.openfoodfacts.org/openapi.json

@teolemon
Copy link
Member Author

teolemon commented May 7, 2021

Is there a FASTAPI option or plugin to generate it in command line for Continuous Integration purposes or other things ?

@teolemon
Copy link
Member Author

teolemon commented May 7, 2021

Eg:

  • to check a proposed PR for certain things
  • to generate SDKs and publish them on repositories

Sorry, something went wrong.

@cquest
Copy link
Collaborator

cquest commented May 7, 2021

See: https://github.com/openfoodfacts/folksonomy_api/blob/main/generate_openapi_json.py

It calls fastapi and generates the openapi.json on stdout.

@teolemon teolemon requested review from cquest and removed request for cquest May 12, 2021 14:26
@teolemon
Copy link
Member Author

======================
= Linting OAS file =

OpenAPI 3.x detected

/github/workspace/openapi.json
1:1 warning oas3-api-servers OpenAPI servers must be present and non-empty array.
1:1 warning openapi-tags OpenAPI object should have non-empty tags array.
1:29 warning info-contact Info object should contain contact object. info
1:29 warning info-description OpenAPI object info description must be present and non-empty string. info
1:122 warning operation-description Operation description must be present and non-empty string. paths./.get
1:122 warning operation-tags Operation should have non-empty tags array. paths./.get
1:303 warning operation-tags Operation should have non-empty tags array. paths./auth.post
1:1125 warning operation-tags Operation should have non-empty tags array. paths./products.get
1:2063 warning operation-tags Operation should have non-empty tags array. paths./product/{product}.get
1:2895 warning operation-tags Operation should have non-empty tags array. paths./product/{product}/{k}.get
1:3686 warning operation-tags Operation should have non-empty tags array. paths./product/{product}/{k}.delete
1:4581 warning operation-tags Operation should have non-empty tags array. paths./product/{product}/{k}/versions.get
1:5580 warning operation-tags Operation should have non-empty tags array. paths./product/{product}/{k}/version/{version}.get
1:6534 warning operation-tags Operation should have non-empty tags array. paths./product.put
1:7317 warning operation-tags Operation should have non-empty tags array. paths./product.post
1:7892 warning operation-tags Operation should have non-empty tags array. paths./keys.get
1:8507 warning operation-tags Operation should have non-empty tags array. paths./ping.get

✖ 17 problems (0 errors, 17 warnings, 0 infos, 0 hints)

@teolemon
Copy link
Member Author

E psycopg2.OperationalError: could not connect to server: No such file or directory
E Is the server running locally and accepting
E connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

@teolemon
Copy link
Member Author

I managed to populate and connect to the db
Half of the tests are passing

=========================== short test summary info ============================
FAILED tests/test_main.py::test_product - TypeError: 'NoneType' object is not...
FAILED tests/test_main.py::test_product_key - TypeError: 'NoneType' object is...
FAILED tests/test_main.py::test_product_key_missing - TypeError: 'NoneType' o...
FAILED tests/test_main.py::test_product_key_versions - TypeError: 'NoneType' ...
FAILED tests/test_main.py::test_product_key_last_version - TypeError: 'NoneTy...
FAILED tests/test_main.py::test_product_key_first_version - TypeError: 'NoneT...
FAILED tests/test_main.py::test_product_key_versions_missing - TypeError: 'No...
FAILED tests/test_main.py::test_products_list_key_value - TypeError: 'NoneTyp...
FAILED tests/test_main.py::test_products_list_key - TypeError: 'NoneType' obj...
========================= 9 failed, 8 passed in 6.24s ==========================

@teolemon teolemon changed the title [WIP] Validation of OpenAPI files using GitHub Actions ci: Validation of OpenAPI files using GitHub Actions Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

None yet

2 participants