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

kie-issues#2718: [kn-plugin-workflow] Minify the openAPI spec files to trim components/schemas #2749

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

treblereel
Copy link
Contributor

issue: #2718

@treblereel
Copy link
Contributor Author

Path declarations may contain $ref references, which in turn may refer to other declarations. Therefore, before removing them, it is necessary to identify all declarations that the desired operationId depends on. A special case is securitySchemes; if they are present in the document, they should be retained since the reference to them occurs implicitly.

Copy link
Member

@ricardozanini ricardozanini 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, man!

return nil, fmt.Errorf("❌ ERROR: failed to load OpenAPI document: %w", err)
}
if doc.Paths == nil {
return nil, fmt.Errorf("OpenAPI document %s has no paths", specFileName)
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to return an error here? Maybe just log silently to not spur the user's console with an error. If this is handled by the caller, just ignore my comment.

Copy link
Contributor

@domhanak domhanak left a comment

Choose a reason for hiding this comment

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

Looks good to me, the file is minimized:

✅ Minified file /home/dhanak/Downloads/subflows/specs/greetingAPI.min.yaml created with 514 bytes (original size: 6248 bytes)

Components and schemas are trimmed as expected.

@treblereel treblereel self-assigned this Jan 8, 2025
@treblereel treblereel merged commit b3d2594 into apache:main Jan 8, 2025
14 checks passed
jomarko added a commit to jomarko/kie-tools that referenced this pull request Jan 9, 2025
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.

4 participants