Add support for controlling output of OpenAPI Generator version in generated files (#17952)

* add initial openapi config and java generated files

* add java implementation for adding generator version

* regenerate sample client files

* remove tabs

* only show generated version if build info exists

* set build info for batch generation

* update generator doc for new global flag

* use existing property for generator version

* update templates to include generator version

* update templates for better generator version syntax

* revert undesired changes

* regenerate samples for openapi client

* update templates to correct formatting/newlines

* correct description text and add to usage doc

* add generator cli option for all codegen types

* use more concise version info; update existing codegens to support new prop

* correct wrong prop reference

* add initial test coverage for new prop

* update last (scala) templates with new prop

* update samples after upstream merge

* use consistent version output

* use better sample project id/name

* revert using option for generator version in templates
This commit is contained in:
Ross Bender
2024-03-09 01:52:08 -06:00
committed by GitHub
parent c87ad561f1
commit cf2435f335
5612 changed files with 34853 additions and 5131 deletions

View File

@@ -30,7 +30,7 @@ import org.hibernate.validator.constraints.*;
/**
* AdditionalPropertiesAnyType
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class AdditionalPropertiesAnyType extends HashMap<String, Object> {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -31,7 +31,7 @@ import org.hibernate.validator.constraints.*;
/**
* AdditionalPropertiesArray
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class AdditionalPropertiesArray extends HashMap<String, List> {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -30,7 +30,7 @@ import org.hibernate.validator.constraints.*;
/**
* AdditionalPropertiesBoolean
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class AdditionalPropertiesBoolean extends HashMap<String, Boolean> {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
/**
* AdditionalPropertiesClass
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class AdditionalPropertiesClass {
public static final String SERIALIZED_NAME_MAP_STRING = "map_string";
@SerializedName(SERIALIZED_NAME_MAP_STRING)

View File

@@ -30,7 +30,7 @@ import org.hibernate.validator.constraints.*;
/**
* AdditionalPropertiesInteger
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class AdditionalPropertiesInteger extends HashMap<String, Integer> {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -31,7 +31,7 @@ import org.hibernate.validator.constraints.*;
/**
* AdditionalPropertiesNumber
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class AdditionalPropertiesNumber extends HashMap<String, BigDecimal> {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -30,7 +30,7 @@ import org.hibernate.validator.constraints.*;
/**
* AdditionalPropertiesObject
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class AdditionalPropertiesObject extends HashMap<String, Map> {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -30,7 +30,7 @@ import org.hibernate.validator.constraints.*;
/**
* AdditionalPropertiesString
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class AdditionalPropertiesString extends HashMap<String, String> {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Animal
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Animal {
public static final String SERIALIZED_NAME_CLASS_NAME = "className";
@SerializedName(SERIALIZED_NAME_CLASS_NAME)

View File

@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
/**
* ArrayOfArrayOfNumberOnly
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ArrayOfArrayOfNumberOnly {
public static final String SERIALIZED_NAME_ARRAY_ARRAY_NUMBER = "ArrayArrayNumber";
@SerializedName(SERIALIZED_NAME_ARRAY_ARRAY_NUMBER)

View File

@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
/**
* ArrayOfNumberOnly
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ArrayOfNumberOnly {
public static final String SERIALIZED_NAME_ARRAY_NUMBER = "ArrayNumber";
@SerializedName(SERIALIZED_NAME_ARRAY_NUMBER)

View File

@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
/**
* ArrayTest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ArrayTest {
public static final String SERIALIZED_NAME_ARRAY_OF_STRING = "array_of_string";
@SerializedName(SERIALIZED_NAME_ARRAY_OF_STRING)

View File

@@ -29,7 +29,7 @@ import org.hibernate.validator.constraints.*;
/**
* BigCat
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class BigCat extends Cat {
/**
* Gets or Sets kind

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Capitalization
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Capitalization {
public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel";
@SerializedName(SERIALIZED_NAME_SMALL_CAMEL)

View File

@@ -29,7 +29,7 @@ import org.hibernate.validator.constraints.*;
/**
* Cat
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Cat extends Animal {
public static final String SERIALIZED_NAME_DECLAWED = "declawed";
@SerializedName(SERIALIZED_NAME_DECLAWED)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Category
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Category {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Model for testing model with \&quot;_class\&quot; property
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ClassModel {
public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class";
@SerializedName(SERIALIZED_NAME_PROPERTY_CLASS)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Client
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Client {
public static final String SERIALIZED_NAME_CLIENT = "client";
@SerializedName(SERIALIZED_NAME_CLIENT)

View File

@@ -29,7 +29,7 @@ import org.hibernate.validator.constraints.*;
/**
* Dog
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Dog extends Animal {
public static final String SERIALIZED_NAME_BREED = "breed";
@SerializedName(SERIALIZED_NAME_BREED)

View File

@@ -31,7 +31,7 @@ import org.hibernate.validator.constraints.*;
/**
* EnumArrays
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class EnumArrays {
/**
* Gets or Sets justSymbol

View File

@@ -29,7 +29,7 @@ import org.hibernate.validator.constraints.*;
/**
* EnumTest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class EnumTest {
/**
* Gets or Sets enumString

View File

@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
/**
* FileSchemaTestClass
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class FileSchemaTestClass {
public static final String SERIALIZED_NAME_FILE = "file";
@SerializedName(SERIALIZED_NAME_FILE)

View File

@@ -33,7 +33,7 @@ import org.hibernate.validator.constraints.*;
/**
* FormatTest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class FormatTest {
public static final String SERIALIZED_NAME_INTEGER = "integer";
@SerializedName(SERIALIZED_NAME_INTEGER)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* HasOnlyReadOnly
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class HasOnlyReadOnly {
public static final String SERIALIZED_NAME_BAR = "bar";
@SerializedName(SERIALIZED_NAME_BAR)

View File

@@ -30,7 +30,7 @@ import org.hibernate.validator.constraints.*;
/**
* MapTest
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class MapTest {
public static final String SERIALIZED_NAME_MAP_MAP_OF_STRING = "map_map_of_string";
@SerializedName(SERIALIZED_NAME_MAP_MAP_OF_STRING)

View File

@@ -33,7 +33,7 @@ import org.hibernate.validator.constraints.*;
/**
* MixedPropertiesAndAdditionalPropertiesClass
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class MixedPropertiesAndAdditionalPropertiesClass {
public static final String SERIALIZED_NAME_UUID = "uuid";
@SerializedName(SERIALIZED_NAME_UUID)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Model for testing model name starting with number
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Model200Response {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* ModelApiResponse
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ModelApiResponse {
public static final String SERIALIZED_NAME_CODE = "code";
@SerializedName(SERIALIZED_NAME_CODE)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Must be named &#x60;File&#x60; for test.
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ModelFile {
public static final String SERIALIZED_NAME_SOURCE_U_R_I = "sourceURI";
@SerializedName(SERIALIZED_NAME_SOURCE_U_R_I)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* ModelList
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ModelList {
public static final String SERIALIZED_NAME_123LIST = "123-list";
@SerializedName(SERIALIZED_NAME_123LIST)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Model for testing reserved words
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ModelReturn {
public static final String SERIALIZED_NAME_RETURN = "return";
@SerializedName(SERIALIZED_NAME_RETURN)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Model for testing model name same as property name
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Name {
public static final String SERIALIZED_NAME_NAME = "name";
@SerializedName(SERIALIZED_NAME_NAME)

View File

@@ -29,7 +29,7 @@ import org.hibernate.validator.constraints.*;
/**
* NumberOnly
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class NumberOnly {
public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber";
@SerializedName(SERIALIZED_NAME_JUST_NUMBER)

View File

@@ -29,7 +29,7 @@ import org.hibernate.validator.constraints.*;
/**
* Order
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Order {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)

View File

@@ -29,7 +29,7 @@ import org.hibernate.validator.constraints.*;
/**
* OuterComposite
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class OuterComposite {
public static final String SERIALIZED_NAME_MY_NUMBER = "my_number";
@SerializedName(SERIALIZED_NAME_MY_NUMBER)

View File

@@ -35,7 +35,7 @@ import org.hibernate.validator.constraints.*;
/**
* Pet
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Pet {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* ReadOnlyFirst
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class ReadOnlyFirst {
public static final String SERIALIZED_NAME_BAR = "bar";
@SerializedName(SERIALIZED_NAME_BAR)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* SpecialModelName
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class SpecialModelName {
public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]";
@SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* Tag
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class Tag {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)

View File

@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
/**
* TypeHolderDefault
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class TypeHolderDefault {
public static final String SERIALIZED_NAME_STRING_ITEM = "string_item";
@SerializedName(SERIALIZED_NAME_STRING_ITEM)

View File

@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
/**
* TypeHolderExample
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class TypeHolderExample {
public static final String SERIALIZED_NAME_STRING_ITEM = "string_item";
@SerializedName(SERIALIZED_NAME_STRING_ITEM)

View File

@@ -28,7 +28,7 @@ import org.hibernate.validator.constraints.*;
/**
* User
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class User {
public static final String SERIALIZED_NAME_ID = "id";
@SerializedName(SERIALIZED_NAME_ID)

View File

@@ -32,7 +32,7 @@ import org.hibernate.validator.constraints.*;
/**
* XmlItem
*/
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen")
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.4.0-SNAPSHOT")
public class XmlItem {
public static final String SERIALIZED_NAME_ATTRIBUTE_STRING = "attribute_string";
@SerializedName(SERIALIZED_NAME_ATTRIBUTE_STRING)