Skip to content

Ignore specific files when generating the client #454

Description

@clasnake

Is your feature request related to a problem? Please describe.
When generating the client from open api spec, sometimes we need to prevent some specific files to be overwritten. I haven't found a native support in openapi-python-client currently.

Describe the solution you'd like
We can follow the .gitignore pattern and provide something like .openapi_python_ignore.

Describe alternatives you've considered
N/A

Additional context
N/A

Activity

  1. emann commented on Jul 20, 2021

    @emann
    Contributor

    When you say files being overwritten, do you mean in the generated client? i.e. generate version A, update it to version B, but leave some files untouched? Or do you mean you want to ignore parts of the spec itself? If so this is likely a duplicate of #55 as that should get you where you need.

  2. bolbken commented on Jul 28, 2021

    @bolbken

    @clasnake , I think you are describing the same issue that I am facing: This generator does not seem to allow for files not generated from the spec inside the package.

    After a quick browse it appears that the same methods used to in the generate command are used in the update command, seen here. This means that the package is essentially wiped every time an update command is executed as far as I can tell.

    If I'm right, this means that potentially a .openapi-python-ignore is feasible with shutil, but an initial implementation may affect the generate and update commands.

    @emann , what I am describing is similar to what the openapi-generator tool has implemented.

  3. bolbken commented on Jul 28, 2021

    @bolbken

    @emann / @dbanty , I don't intend to push, but ...

    1. What are your thoughts on this feature? Am I missing something?
    2. Is this project open to new contributors?
    3. If some implementation allowing for file/directory ignore patterns materialized... would you want it to affect generate and update commands?
  4. dbanty commented on Jul 28, 2021

    @dbanty
    Collaborator

    @bolbken in order:

    1. Sounds like a great feature, and you’re correct in your assessment of current behavior.
    2. Yes! Though currently we’re rather slow to respond / review 😅. I am mostly limited to weekend time at the moment.
    3. I think it’d make sense to mirror the functionality from openapi-generator. update was just the easy alternative to full ignore functionality so you could leave metadata / external packages in place. I think it just becomes a special case of generate with prebaked ignore rules.. right? I don’t actually use update myself anymore so I could be forgetting something >_>.
  5. bolbken commented on Jul 29, 2021

    @bolbken

    @dbanty Thanks for the quick, concise response.

    In the coming weeks I may take this on and attempt an implementation. This is truly a superior generator for python clients from openapi specs. Looking forward to potentially being able to contribute in the future. Thanks! :)

  6. adelevie commented on Jul 19, 2022

    @adelevie
    Contributor

    Hi @dbanty -- I am curious if you think this feature belongs in this library. I certainly do, though there seem to be several plausible implementations.

  7. locked and limited conversation to collaborators on Aug 13, 2023
  8. converted this issue into a discussion #826 on Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions