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

http-api: T6736: move REST API to a node distinct from GraphQL API #4110

Open
wants to merge 9 commits into
base: current
Choose a base branch
from

Conversation

jestabro
Copy link
Contributor

@jestabro jestabro commented Sep 30, 2024

Change Summary

The REST API was originally implemented under the node ['service', 'https', 'api'], and the GraphQL API implemented as a subnode of that path. Refactor the http-api server into distinct configuration nodes:

['service', 'https', 'api', 'rest']
['service', 'https', 'api', 'graphql']

Structures shared by the apis are simplified; distinct structures are organized more symmetrically.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Code style update (formatting, renaming)

  • Refactoring (no functional changes)
    --- the one functional change is that the GraphQL API may now be made available independently of the REST API.

  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component

  • Other (please describe):

Related Task(s)

Related PR(s)

vyos/vyos-documentation#1557

Component(s) name

Proposed changes

How to test

Smoketest result

DEBUG - Running Testcase: /usr/libexec/vyos/tests/smoke/cli/test_service_https.py
DEBUG - test_api_add_delete (__main__.TestHTTPSService.test_api_add_delete) ... ok
DEBUG - test_api_auth (__main__.TestHTTPSService.test_api_auth) ... ok
DEBUG - test_api_config_file (__main__.TestHTTPSService.test_api_config_file) ... ok
DEBUG - test_api_config_file_load_http (__main__.TestHTTPSService.test_api_config_file_load_http) ... ok
DEBUG - test_api_configure (__main__.TestHTTPSService.test_api_configure) ... ok
DEBUG - test_api_generate (__main__.TestHTTPSService.test_api_generate) ... ok
DEBUG - test_api_image (__main__.TestHTTPSService.test_api_image) ... ok
DEBUG - test_api_incomplete_key (__main__.TestHTTPSService.test_api_incomplete_key) ... ok
DEBUG - test_api_missing_keys (__main__.TestHTTPSService.test_api_missing_keys) ... ok
DEBUG - test_api_reset (__main__.TestHTTPSService.test_api_reset) ... ok
DEBUG - test_api_show (__main__.TestHTTPSService.test_api_show) ... ok
DEBUG - test_certificate (__main__.TestHTTPSService.test_certificate) ... ok
DEBUG -
DEBUG - ----------------------------------------------------------------------
DEBUG - Ran 12 tests in 70.122s
DEBUG -
DEBUG - OK

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • I have run the components SMOKETESTS if applicable
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

The GraphQL API was implemented as an addition to the existing REST API.
As there is no necessary dependency, separate the initialization of the
respective endpoints. Factor out the REST Pydantic models and FastAPI
routes for symmetry and clarity.
Avoid duplicate entries in the list of routes when adding/deleting
endpoints.
Copy link

github-actions bot commented Sep 30, 2024

👍
No issues in PR Title / Commit Title

Copy link

github-actions bot commented Sep 30, 2024

✅ No issues found in unused-imports check.. Please refer the workflow run

src/services/api/rest/models.py Fixed Show fixed Hide fixed
src/services/api/rest/models.py Fixed Show fixed Hide fixed
src/services/api/rest/models.py Dismissed Show dismissed Hide dismissed
src/services/api/rest/models.py Dismissed Show dismissed Hide dismissed
@jestabro
Copy link
Contributor Author

jestabro commented Oct 1, 2024

The only remaining linting errors are due to an attempt to apply ruff to a now deleted file (since listed as a 'changed' file). Need to use added|modified in filter here:
https://github.com/vyos/.github/blob/current/.github/workflows/lint-with-ruff.yml#L28

@jestabro
Copy link
Contributor Author

jestabro commented Oct 1, 2024

Comments as to why the CodeQL scans are now dismissed are under 'Show dismissed'/'Show more details', namely:

  1. The stack trace does not expose any structure that is not already apparent by inspection of the open source code repository.
  2. The code scan is missing the fact that the return value is now sanitized by html.escape().

@jestabro
Copy link
Contributor Author

jestabro commented Oct 1, 2024

Linting error fixed with:
vyos/.github#49

Copy link

github-actions bot commented Oct 1, 2024

CI integration ❌ failed!

Details

CI logs

  • CLI Smoketests ❌ failed
  • Config tests 👍 passed
  • RAID1 tests 👍 passed
  • TPM tests 👍 passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants