openapi-processor / openapi-processor-spring

an OpenAPI 3.0 & 3.1 interface & model java code generator for Spring Boot
https://docs.openapiprocessor.io
Apache License 2.0
40 stars 9 forks source link

Don't add the @Generated annotation (configurable) #269

Closed mjparme closed 5 months ago

mjparme commented 5 months ago

I don't understand the need to add the noise of the @Generated annotation to every class. It would be nice if there was a configuration option to not add it.

I don't need @Generated(value = "openapi-processor-spring", version = "2024.3") in the generated classes.

hauner commented 5 months ago

The @Generated annotation helps some tools to ignore the generated code. jacoco for example doesn't report code coverage of @Generated classes. For this reason many generators add it.

The generated code has a lot of required annotations already. Where is the benefit removing this single annotation?

mjparme commented 5 months ago

In my case I sometimes move the generated code into src/main/java if the generated code almost never changes (I just need the model files). In that case I also have to move the support package (or remove the generated annotation).

hauner commented 5 months ago

Ok, sounds like a valid use case. 😄 What is wrong with the interfaces?

mjparme commented 5 months ago

What is wrong with the interfaces?

I am creating a client, so I only need the models. Although I have implemented a API using this as well and in that case I removed the interfaces because I didn't like switch between the interface and the implementation to see the mappings. Easier if it is all in one file.