Skip to content

sanitize command #46

Closed
Closed

Description

@zdunecki

Hi, thanks for CLI, it's pretty nice.

Are willing to create an sanitize function? Let's say I'd like to have a clean output without x-go and other mess.

If possible, are you open to such change as contribution?

Best,

Activity

  1. TristanSpeakEasy commented on Sep 9, 2025

    @TristanSpeakEasy
    Member

    Hey @zdunecki do you have an example document and a list of the things you would like it to deal with?

    When you mention x-go is that an extension you have in your document? That you want removed?

  2. zdunecki commented on Sep 9, 2025

    @zdunecki
    Author

    It would be awesome to have control over what should be sanitized.

    Yes, I'm using x-go-<name> extensions for a server codegen, but as a client, it's useful and sometimes necessary to delete some parts of OpenAPI spec.

    I think it may be reasonable to have a sanitizer that removes ALL things that are not from the standard OpenAPI spec + an API to control what elements should be sanitized, for example, via an option like:

    sanitizer:
     extensions:
      match: "x-go-*"
    

    (rly prof of concept)

  3. TristanSpeakEasy commented on Sep 9, 2025

    @TristanSpeakEasy
    Member

    thanks for the suggestion @zdunecki I will start with something that as you says just removes anything not native to the OAS.

    And will look at adding some options for targeting specific extensions, specifying options to remove unused components etc and we can make it extensible for any future suggestions.

    Not sure I will get to it this week but will definitely add it shortly

  4. zdunecki commented on Sep 9, 2025

    @zdunecki
    Author

    @TristanSpeakEasy

    Thanks a lot. If you need a contribution, I'm open.

  5. TristanSpeakEasy commented on Sep 9, 2025

    @TristanSpeakEasy
    Member
  6. TristanSpeakEasy commented on Oct 13, 2025

    @TristanSpeakEasy
    Member

    @zdunecki I had a go at implementing this here #59 please have a look and let me know what you think

  7. TristanSpeakEasy commented on Oct 14, 2025

    @TristanSpeakEasy
    Member

    This feature has just been released and will be in the next build of the CLI https://github.com/speakeasy-api/openapi/releases/tag/v1.8.0

  8. zdunecki commented on Oct 14, 2025

    @zdunecki
    Author

    @TristanSpeakEasy

    Wow, thanks!

    At first glance, it looks fine, but as far as I can see, sanitization works only by excluding something, not including.

    If so, for many cases it will be harder to maintain, cuz in my case, for example, I need to sanitize it to the most common format - like supporting only a few extensions. Including will be much easier than excluding

    Best,

  9. locked and limited conversation to collaborators on Oct 14, 2025
  10. converted this issue into a discussion #62 on Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or requestgood first issueGood for newcomersopenapiRelated to OpenAPI core functionality

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions