Skip to content

Commit 86333c2

Browse files
committed
fix: use parameter generateTimestamp to suppress timestamp in @generated annotation #433
Signed-off-by: anessi <[email protected]>
1 parent 4e2766b commit 86333c2

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,21 +72,22 @@ It is RECOMMENDED to not use anonymous objects in payload and components definit
7272
7373
### Supported parameters
7474
75-
|Name|Description| Required | Default |
76-
|---|---|----------|--------------------------|
77-
|disableEqualsHashCode|Disable generation of equals and hashCode methods for model classes.| No | `false` |
78-
|inverseOperations|Generate an application that will publish messages to `publish` operation of channels and read messages from `subscribe` operation of channels. Literally this flag will simply swap `publish` and `subscribe` operations in the channels. <br> This flag will be useful when you want to generate a code of mock for your main application. Be aware, generation could be incomplete and manual changes will be required e.g. if bindings are defined only for case of main application.| No | `false` |
79-
|javaPackage|The Java package of the generated classes. Alternatively you can set the specification extension `info.x-java-package`. If both extension and parameter are used, parameter has more priority.| No | `com.asyncapi` |
80-
|springBoot2|Generate template files for the Spring Boot version 2. For kafka protocol it will also force to use spring-kafka 2.9.9| No | `false` |
81-
|maven|Generate pom.xml Maven build file instead of Gradle build.|No | `false` |
82-
|listenerPollTimeout|Only for Kafka. Timeout in ms to use when polling the consumer.| No | `3000` |
83-
|listenerConcurrency|Only for Kafka. Number of threads to run in the listener containers.| No | `3` |
84-
|addTypeInfoHeader|Only for Kafka. Add type information to message header.| No | `true` |
85-
|connectionTimeout|Only for MQTT. This value, measured in seconds, defines the maximum time interval the client will wait for the network connection to the MQTT server to be established. The default timeout is 30 seconds. A value of 0 disables timeout processing meaning the client will wait until the network connection is made successfully or fails.| No | `30` |
86-
|disconnectionTimeout|Only for MQTT. The completion timeout in milliseconds when disconnecting. The default disconnect completion timeout is 5000 milliseconds.| No | `5000` |
87-
|completionTimeout|Only for MQTT. The completion timeout in milliseconds for operations. The default completion timeout is 30000 milliseconds.| No | `30000` |
88-
|mqttClientId| Only for MQTT. Provides the client identifier for the MQTT server. This parameter overrides the value of the clientId if it's set in the AsyncAPI file.If both aren't provided, a default value is set.| No | |
89-
|asyncapiFileDir| Path where original AsyncAPI file will be stored.| No | `src/main/resources/api/` |
75+
|Name| Description | Required | Default |
76+
|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------------------------|
77+
|disableEqualsHashCode| Disable generation of equals and hashCode methods for model classes. | No | `false` |
78+
|inverseOperations| Generate an application that will publish messages to `publish` operation of channels and read messages from `subscribe` operation of channels. Literally this flag will simply swap `publish` and `subscribe` operations in the channels. <br> This flag will be useful when you want to generate a code of mock for your main application. Be aware, generation could be incomplete and manual changes will be required e.g. if bindings are defined only for case of main application. | No | `false` |
79+
|javaPackage| The Java package of the generated classes. Alternatively you can set the specification extension `info.x-java-package`. If both extension and parameter are used, parameter has more priority. | No | `com.asyncapi` |
80+
|springBoot2| Generate template files for the Spring Boot version 2. For kafka protocol it will also force to use spring-kafka 2.9.9 | No | `false` |
81+
|maven| Generate pom.xml Maven build file instead of Gradle build. |No | `false` |
82+
|listenerPollTimeout| Only for Kafka. Timeout in ms to use when polling the consumer. | No | `3000` |
83+
|listenerConcurrency| Only for Kafka. Number of threads to run in the listener containers. | No | `3` |
84+
|addTypeInfoHeader| Only for Kafka. Add type information to message header. | No | `true` |
85+
|connectionTimeout| Only for MQTT. This value, measured in seconds, defines the maximum time interval the client will wait for the network connection to the MQTT server to be established. The default timeout is 30 seconds. A value of 0 disables timeout processing meaning the client will wait until the network connection is made successfully or fails. | No | `30` |
86+
|disconnectionTimeout| Only for MQTT. The completion timeout in milliseconds when disconnecting. The default disconnect completion timeout is 5000 milliseconds. | No | `5000` |
87+
|completionTimeout| Only for MQTT. The completion timeout in milliseconds for operations. The default completion timeout is 30000 milliseconds. | No | `30000` |
88+
|mqttClientId| Only for MQTT. Provides the client identifier for the MQTT server. This parameter overrides the value of the clientId if it's set in the AsyncAPI file.If both aren't provided, a default value is set. | No | |
89+
|asyncapiFileDir| Path where original AsyncAPI file will be stored. | No | `src/main/resources/api/` |
90+
|generateTimestamp| Adds the generation timestamp to the @Generated annotation. | No | `true` |
9091
### Examples
9192

9293
The shortest possible syntax:

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,11 @@
117117
"description": "Generate pom.xml Maven build file instead of Gradle build",
118118
"default": false,
119119
"required": false
120+
},
121+
"generateTimestamp": {
122+
"description": "Adds the generation timestamp to the @Generated annotation",
123+
"default": "true",
124+
"required": false
120125
}
121126
},
122127
"generator": ">=1.8.27 <2.0.0",

template/src/main/java/com/asyncapi/model/$$objectSchema$$.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* {{ line | safe}}{% endfor %}{% if schema.examples() %}
2222
* Examples: {{schema.examples() | examplesToString | safe}}{% endif %}
2323
*/{% endif %}
24-
@Generated(value="com.asyncapi.generator.template.spring", date="{{''|currentTime }}")
24+
@Generated(value="com.asyncapi.generator.template.spring"{% if params.generateTimestamp === 'true' %}, date="{{''|currentTime }}"{%- endif %})
2525
public class {{schemaName | camelCase | upperFirst}} {
2626
{% for propName, prop in schema.properties() %}
2727
{%- set isRequired = propName | isRequired(schema.required()) %}

0 commit comments

Comments
 (0)