This repository was archived by the owner on Mar 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +34
-3
lines changed
main/resources/mapping/v2.1
testInt/kotlin/io/openapiprocessor/core
test/kotlin/io/openapiprocessor/core/processor/mapping/v2 Expand file tree Collapse file tree 4 files changed +34
-3
lines changed Original file line number Diff line number Diff line change 4747 "description" : " enable/disable code formatting." ,
4848 "type" : " boolean" ,
4949 "default" : true
50+ },
51+ "generated-date" : {
52+ "description" : " enable/disable generated date on the @Generated annotation." ,
53+ "type" : " boolean" ,
54+ "default" : true
5055 }
5156 }
5257 },
53145319 "description" : " enable/disable code formatting." ,
53155320 "type" : " boolean" ,
53165321 "default" : true
5322+ },
5323+ "generated-date" : {
5324+ "description" : " enable/disable generated date on the @Generated annotation." ,
5325+ "type" : " boolean" ,
5326+ "default" : true
53175327 }
53185328 }
53195329 },
Original file line number Diff line number Diff line change 6060 "description" : " enable/disable code formatting." ,
6161 "type" : " boolean" ,
6262 "default" : true
63+ },
64+ "generated-date" : {
65+ "description" : " enable/disable generated date on the @Generated annotation." ,
66+ "type" : " boolean" ,
67+ "default" : true
6368 }
6469 }
6570 },
Original file line number Diff line number Diff line change @@ -117,4 +117,20 @@ class MappingReaderSpec: StringSpec ({
117117 // then:
118118 mapping.options.formatCode shouldBe false
119119 }
120+
121+ " reads generated-date" {
122+ val yaml = """
123+ |openapi-processor-mapping: v2.1
124+ |options:
125+ | generated-date: false
126+ """ .trimMargin()
127+
128+ val reader = MappingReader ()
129+
130+ // when:
131+ val mapping = reader.read (yaml) as Mapping
132+
133+ // then:
134+ mapping.options.generatedDate shouldBe false
135+ }
120136})
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import io.openapiprocessor.core.parser.Parser
1414import io.openapiprocessor.core.writer.java.*
1515import org.slf4j.Logger
1616import org.slf4j.LoggerFactory
17+ import java.time.OffsetDateTime
1718
1819/* *
1920 * Simple processor for testing.
@@ -39,9 +40,8 @@ class TestProcessor: OpenApiProcessor {
3940
4041 val generatedInfo = GeneratedInfo (
4142 " openapi-processor-core" ,
42- " test" ,
43- // OffsetDateTime.now().toString()
44- // url = "https://github.com/openapi-processor/openapi-processor-core"
43+ " test"
44+ // if (options.generatedDate) OffsetDateTime.now().toString() else null
4545 )
4646
4747 val generatedWriter = GeneratedWriterImpl (generatedInfo, options)
You can’t perform that action at this time.
0 commit comments