-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: format transform #1094
feat: format transform #1094
Conversation
2120d1a
to
f13f06b
Compare
f13f06b
to
0aefd26
Compare
var unknownOrder = []string{} | ||
|
||
// Orders contains the order of keys for each node type | ||
type Orders struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly not entirely sure why this is necessary when the individual slices and their existing names are just as clear
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was much easier to use this when adding each level, and the logic for determining the order to use completely changed a few times as I realized some silly mistakes in the initial implementation.
Happy to simplify if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really great! Just needs a few basic tests
Added a whole document test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
This pull request introduces a new command to format OpenAPI documents and includes corresponding tests. The most important changes include adding the
formatCmd
command, implementing therunFormat
function, and creating tests to ensure the formatting works correctly.New command for formatting OpenAPI documents:
cmd/openapi/transform.go
: Added theformatCmd
command to thetransformCmd
command group, which formats an OpenAPI document to be more human-readable. [1] [2]cmd/openapi/transform.go
: Implemented therunFormat
function to handle the logic for the newformatCmd
command.Tests for the new format command:
internal/transform/format_test.go
: Added tests to verify the behavior of the newformatCmd
command, ensuring that the formatted OpenAPI document matches the expected output.