Skip to content

[OpenAPI] Lift enum member descriptions in property descriptions #4313

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

Merged
merged 7 commits into from
May 6, 2025

Conversation

swallez
Copy link
Member

@swallez swallez commented Apr 28, 2025

The OpenAPI spec doesn't support adding descriptions to enumeration members. This PR fixes that by having the OpenAPI converter lift enum member descriptions in the descriptions of properties of an enum type.

It also handles aliases, enum arrays and lenient arrays (e.g. Foo | Foo[]).

Rendering in bump.sh

image

Enumerations with no descriptions are left unchanged

image

Caveat: for unary values (i.e. not an array or lenient array), bump.sh will still render its list below the descriptions added by this PR. This could be avoided by removing the enumeration values from the OpenAPI spec (and keep them only in the docs), but this would remove some information from that OpenAPI spec.

Example

image

@swallez swallez requested a review from a team as a code owner April 28, 2025 14:39
Comment on lines +588 to +589
writeln!(result)?;
writeln!(result)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this double line expected?

@swallez
Copy link
Member Author

swallez commented Apr 29, 2025

@lcawl should we go ahead with this update?

@timto-elastic
Copy link

If @lcawl is ok with the update, I would love to see this go live so we can have enum descriptions in our API docs.

Copy link
Contributor

@lcawl lcawl left a comment

Choose a reason for hiding this comment

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

I committed two suggested changes to the text (from "Values are" to "Supported values include:") and ran make compiler-wasm-lib locally to see the impact. I haven't checked in the regenerated output since my local tests also affected compiler-rs files that I'm unfamiliar with. If you regenerate the output and are happy with my text changes, it LGTM.

@lcawl lcawl mentioned this pull request May 6, 2025
6 tasks
@lcawl lcawl merged commit 4fb0647 into main May 6, 2025
8 checks passed
@lcawl lcawl deleted the openapi-enum-descriptions branch May 6, 2025 15:20
Copy link
Contributor

github-actions bot commented May 6, 2025

The backport to 9.0 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-9.0 9.0
# Navigate to the new working tree
cd .worktrees/backport-9.0
# Create a new branch
git switch --create backport-4313-to-9.0
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 4fb0647c90c2e8aa4979a035a7833170b1035d2f
# Push it to GitHub
git push --set-upstream origin backport-4313-to-9.0
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-9.0

Then, create a pull request where the base branch is 9.0 and the compare/head branch is backport-4313-to-9.0.

lcawl added a commit that referenced this pull request May 6, 2025
Co-authored-by: Lisa Cawley <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit 4fb0647)
@lcawl
Copy link
Contributor

lcawl commented May 6, 2025

💚 All backports created successfully

Status Branch Result
9.0

Questions ?

Please refer to the Backport tool documentation

l-trotta added a commit that referenced this pull request May 6, 2025
#4313) (#4350)

* [OpenAPI] Lift enum member descriptions in property descriptions (#4313)

Co-authored-by: Lisa Cawley <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit 4fb0647)

* regen

---------

Co-authored-by: Sylvain Wallez <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
lcawl added a commit that referenced this pull request May 6, 2025
Co-authored-by: Lisa Cawley <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit 4fb0647)
@lcawl
Copy link
Contributor

lcawl commented May 6, 2025

💚 All backports created successfully

Status Branch Result
8.19

Questions ?

Please refer to the Backport tool documentation

lcawl added a commit that referenced this pull request May 6, 2025
Co-authored-by: Lisa Cawley <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
(cherry picked from commit 4fb0647)
@lcawl
Copy link
Contributor

lcawl commented May 6, 2025

💚 All backports created successfully

Status Branch Result
8.18

Questions ?

Please refer to the Backport tool documentation

lcawl added a commit that referenced this pull request May 7, 2025
…) (#4355)

(cherry picked from commit 4fb0647)

Co-authored-by: Sylvain Wallez <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
lcawl added a commit that referenced this pull request May 7, 2025
…) (#4354)

(cherry picked from commit 4fb0647)

Co-authored-by: Sylvain Wallez <[email protected]>
Co-authored-by: Laura Trotta <[email protected]>
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.

5 participants