swagger codegen is overwriting my custom code in generated files

后端 未结 3 1551
死守一世寂寞
死守一世寂寞 2021-02-05 20:31

I used the swagger codegen to generate jaxrs server side classes and also client side java classes.

This is the command I used to generate the classes

ja         


        
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-05 21:13

    You can specify the files you want to ignore in .swagger-codegen-ignore file

    Here is the sample self explainatory auto-generated code for .swagger-codegen-ignore file

    # Swagger Codegen Ignore
    # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
    
    # Use this file to prevent files from being overwritten by the generator.
    # The patterns follow closely to .gitignore or .dockerignore.
    
    # As an example, the C# client generator defines ApiClient.cs.
    # You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
    #ApiClient.cs
    
    # You can match any string of characters against a directory, file or extension with a single asterisk (*):
    #foo/*/qux
    # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
    
    # You can recursively match patterns against a directory, file or extension with a double asterisk (**):
    #foo/**/qux
    # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
    
    # You can also negate patterns with an exclamation (!).
    # For example, you can ignore all files in a docs folder with the file extension .md:
    #docs/*.md
    # Then explicitly reverse the ignore rule for a single file:
    #!docs/README.md
    

    You can add some lines below this to ignore e.g. I want to ignore all file in folder impl so I added the following line to do that

    **/impl/*
    

提交回复
热议问题