Skip to content

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Sep 17, 2025

🚥 Resolves CX-1793

🧰 Changes

expanding on the work from #1344, this PR tweaks a bunch of logic / DX improvements to better account for the following rdme openapi upload edge cases:

  • URL uploads that lack a path but have a custom slug with a JSON file extension (e.g., rdme openapi upload https://example.com --custom-slug.json) will now properly read that file and set that slug
  • URL uploads that lack a path but have a custom slug with a YAML file extension (e.g., rdme openapi upload https://example.com --custom-slug.yml) will now properly read that file and set that slug
  • URL uploads that lack a path and there's no --slug passed (e.g., rdme openapi upload https://example.com) will now default to openapi.json and emit a warning about this behavior
  • URL uploads with a path that lacks a file extension and there's no --slug passed (e.g., rdme openapi upload https://example.com/some-path) will now properly handle JSON/YAML and set the slug to that path (e.g., some-path.json). [applicable for both creates and updates]

🧬 QA & Testing

honestly the more test cases i added, the more rework i realized this logic required 😮‍💨 the fact that they're passing brings me a lot of comfort here lol

@kanadgupta kanadgupta changed the title fix(openapi/upload): more edge case handling for URLs with no pathnames fix(openapi/upload): more edge case handling for URL uploads Sep 17, 2025
@kanadgupta kanadgupta added command:openapi Issues pertaining to the `openapi`, `validate`, `reduce`, or `swagger` commands bug Something isn't working labels Sep 20, 2025
Copy link
Member Author

Choose a reason for hiding this comment

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

the diff in this file is pretty rough apologies 😭 i had to shuffle a bit of logic around to hit all of these edge cases and tried to simplify logic and add comments wherever i could. might be easier to just read the file top-to-bottom to be honest 😮‍💨

Copy link
Member Author

Choose a reason for hiding this comment

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

other than the new tests, the other test refactors are either stricter assertions or minor variable renaming!

@kanadgupta kanadgupta marked this pull request as ready for review September 20, 2025 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working command:openapi Issues pertaining to the `openapi`, `validate`, `reduce`, or `swagger` commands
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant