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

internal/proto: improvements to OpenAPIv2 spec #4555

Merged
merged 21 commits into from
Apr 8, 2024

Conversation

johanbrandhorst
Copy link
Collaborator

@johanbrandhorst johanbrandhorst commented Mar 21, 2024

This PR attempts to refactor much of the patterns used in our protobuf documentation to improve the experience of using the API documentation. Among the general changes:

  1. Include the error response schema in responses
  2. Greatly improve the introduction to the API page
  3. Include the version of Boundary in the spec
  4. Explicitly set a tag for each service
  5. Correct documentation for the page_size field (some services said a page_size greater than max_page_size results in an error, and some said that it resulted in coercion to the value. The latter is correct)
  6. Add a number of metadata fields (host, security header, external docs link, license link)

This PR also contains the beginnings of a refactor of all the service files. So far, account_service.proto and alias_service.proto (and dependencies) have been updated with the following:

  1. Replace uses of // Output only with the (google.api.field_behavior) = OUTPUT_ONLY annotation option. The old string confused users as it was part of the field description
  2. Add the (google.api.field_behavior) = REQUIRED annotation option to fields that are required in requests this turned out to be the wrong call as it causes confusion when updating a resource.
  3. Lowercase features (Account -> account) in accordance with the Boundary docs style guide
  4. Add or improve field descriptions where necessary
  5. Provide extensive documentation to attribute fields. Previously, attribute fields were completely opaque to users. We now have example inputs for attributes.
  6. Clarify that the version field is not required when creating a resource

I intend to go through the rest of the service files as and when I find time in the next few weeks. If anyone is interested in helping with this effort, please reach out to me 😄.

Reviewers: copy the contents of controller.swagger.json and upload to https://developer.hashicorp.services/open-api-docs-preview to review the look of the changes. Feel free to also try uploading it to https://editor-next.swagger.io/ to compare against a more capable OpenAPIv2 renderer. Note that the developer preview OpenAPI docs page suffers a few issues. If you see anything that isn't already mentioned in the feedback doc, let me know.

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 21, 2024

CLA assistant check
All committers have signed the CLA.

url: "https://github.com/hashicorp/boundary/blob/main/LICENSE"
};
}
host: "your-boundary-hostname.com"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have something like localhost:9200 here as well, not sure what makes this the most obvious that it depends on their Boundary deployment?

@johanbrandhorst johanbrandhorst changed the title internal/gen: better API docs internal/gen: improvements to OpenAPIv2 spec Mar 22, 2024
@johanbrandhorst johanbrandhorst marked this pull request as ready for review March 22, 2024 23:03
@johanbrandhorst johanbrandhorst changed the title internal/gen: improvements to OpenAPIv2 spec internal/proto: improvements to OpenAPIv2 spec Mar 22, 2024
@johanbrandhorst johanbrandhorst added this to the 0.16.x milestone Mar 22, 2024
@johanbrandhorst johanbrandhorst force-pushed the jbrandhorst-api-docs-improvements branch from 5f0b8aa to 187ccbb Compare March 25, 2024 20:21
Copy link
Contributor

@talanknight talanknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! Thank you!

Copy link
Contributor

@talanknight talanknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. Thank you!

@stellarsquall stellarsquall added the event/boundary-docs-day Boundary Docs Day event label Apr 2, 2024
Copy link
Contributor

@Dan-Heath Dan-Heath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work on this! This was a huge effort, many thanks to the whole API Docs Days team that worked on it. Our customers will greatly benefit from the more consistent presentation of resource names and other information. And I love that you included links to external docs where appropriate!

I added suggestions for style and standards. Please let me know if you have any questions about my feedback. Also, if you're short on time to follow up, I'd be happy to apply the updates. Just let me know how I can help.

Thank you!

internal/gen/controller.swagger.json Outdated Show resolved Hide resolved
internal/gen/controller.swagger.json Outdated Show resolved Hide resolved
internal/gen/controller.swagger.json Outdated Show resolved Hide resolved
internal/gen/controller.swagger.json Outdated Show resolved Hide resolved
internal/gen/controller.swagger.json Outdated Show resolved Hide resolved
sdk/pbs/controller/api/resources/scopes/scope.pb.go Outdated Show resolved Hide resolved
sdk/pbs/controller/api/resources/scopes/scope.pb.go Outdated Show resolved Hide resolved
sdk/pbs/controller/api/resources/scopes/scope.pb.go Outdated Show resolved Hide resolved
sdk/pbs/controller/api/resources/scopes/scope.pb.go Outdated Show resolved Hide resolved
johanbrandhorst and others added 21 commits April 5, 2024 21:46
Add various pieces of metadata that can be used by the API docs renderer.
Improve the service labels by specifying explicit tags.
Specify error responses. Specify version at generation time.
The default error entry is now used to cover all errors, as
adding a new error for every possible status code was a bit much.
This also properly includes the real error type now!
…rer. Improve the service labels by specifying explicit tags.
Replace Output Only comments with a field behavior annotation in accounts.
Mark some fields as required.
Add elaborate description for attributes.
Copy parts of the API docs into the description
Unfortunately, while these help with the creating of resources, they still
appear required in contexts where they are not, such as when
updating a resource.
Copy link
Contributor

@Dan-Heath Dan-Heath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing work on this Johan and team!! Thanks so much for all your hard work. This is a significant improvement for our users! 🎉

@johanbrandhorst johanbrandhorst merged commit 6b53766 into main Apr 8, 2024
64 checks passed
@johanbrandhorst johanbrandhorst deleted the jbrandhorst-api-docs-improvements branch April 8, 2024 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants