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

Remove ?public from API specification #14671

Open
10 tasks
markylaing opened this issue Dec 16, 2024 · 2 comments
Open
10 tasks

Remove ?public from API specification #14671

markylaing opened this issue Dec 16, 2024 · 2 comments
Labels
Documentation Documentation needs updating Improvement Improve to current situation
Milestone

Comments

@markylaing
Copy link
Contributor

The ?public endpoints in our swagger documentation are causing confusion even internally. So it likely follows that this is confusing to our users also.

The query parameter is not used anywhere. It’s purpose is solely to define different endpoint behaviours when the caller is trusted vs. untrusted.

We can improve our swagger documentation so that this distinction is made in the endpoint description.

Here is a list of endpoints that need updating:

  • GET /1.0
  • POST /1.0/auth/identities/tls
  • POST /1.0/certificates
  • GET /1.0/images/{fingerprint}/export
  • GET /1.0/images/{fingerprint}
  • GET /1.0/images/aliases/{name}
  • GET /1.0/images
  • GET /1.0/images?recursion=1
  • GET /1.0/operations/{id}/wait
  • GET /1.0/operations/{id}/websocket
@markylaing
Copy link
Contributor Author

Initial investigation for the /1.0 endpoint revealed that it’s not easy to document the return of multiple API types from the same endpoint.

I tried using oneOf but go-swagger didn’t like it:

operation (server_get): yaml: line 28: mapping values are not allowed in this context

@markylaing markylaing added Documentation Documentation needs updating Improvement Improve to current situation labels Dec 16, 2024
@tomponline tomponline added this to the lxd-6.3 milestone Dec 16, 2024
@markylaing
Copy link
Contributor Author

This is more complicated than previously thought.

When an endpoint returns two different responses with the same response code (based on the trusted status of the caller), there is no way to represent this in swagger 2.0 because the oneOf construct is not supported (see https://goswagger.io/go-swagger/reference/models/schemas/#swagger-vs-jsonschema).

We could support this with OpenAPI 3.0, but it doesn't seem easy to generate an OpenAPI 3.0 specification from Golang source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation needs updating Improvement Improve to current situation
Projects
None yet
Development

No branches or pull requests

2 participants