@@ -141,6 +141,7 @@ public void execute(final Template.Fragment frag, final Writer out) throws IOExc
141
141
protected String groupId = "org.openapitools" ;
142
142
protected String artifactId = "openapi-client" ;
143
143
protected String artifactVersion = "1.0.0" ;
144
+ protected boolean headerAttributes = true ;
144
145
145
146
private IncludeMarkupLambda includeSpecMarkupLambda ;
146
147
private IncludeMarkupLambda includeSnippetMarkupLambda ;
@@ -160,7 +161,7 @@ public CodegenType getTag() {
160
161
static String sanitize (final String name ) {
161
162
String sanitized = name == null ? "" : name .trim ();
162
163
sanitized = sanitized .replace ("//" , "/" ); // rest paths may or may not end with slashes, leading to redundant
163
- // path separators.
164
+ // path separators.
164
165
return sanitized .startsWith (File .separator ) || sanitized .startsWith ("/" ) ? sanitized .substring (1 ) : sanitized ;
165
166
}
166
167
@@ -203,13 +204,13 @@ public AsciidocDocumentationCodegen() {
203
204
204
205
cliOptions .add (new CliOption (SNIPPET_DIR ,
205
206
"path with includable markup snippets (e.g. test output generated by restdoc, default: .)" )
206
- .defaultValue ("." ));
207
+ .defaultValue ("." ));
207
208
cliOptions .add (new CliOption (SPEC_DIR ,
208
209
"path with includable markup spec files (e.g. handwritten additional docs, default: ..)" )
209
- .defaultValue (".." ));
210
+ .defaultValue (".." ));
210
211
cliOptions .add (CliOption .newBoolean (HEADER_ATTRIBUTES_FLAG ,
211
212
"generation of asciidoc header meta data attributes (set to false to suppress, default: true)" ,
212
- true ));
213
+ true ));
213
214
214
215
additionalProperties .put ("appName" , "OpenAPI Sample description" );
215
216
additionalProperties .put ("appDescription" , "A sample OpenAPI documentation" );
@@ -240,6 +241,14 @@ public String escapeUnsafeCharacters(String input) {
240
241
return input ; // just return the original string
241
242
}
242
243
244
+ public boolean isHeaderAttributes () {
245
+ return headerAttributes ;
246
+ }
247
+
248
+ public void setHeaderAttributes (boolean headerAttributes ) {
249
+ this .headerAttributes = headerAttributes ;
250
+ }
251
+
243
252
@ Override
244
253
public void processOpts () {
245
254
super .processOpts ();
@@ -264,16 +273,12 @@ public void processOpts() {
264
273
265
274
this .linkSnippetMarkupLambda = new LinkMarkupLambda (snippetDir );
266
275
additionalProperties .put ("snippetlink" , this .linkSnippetMarkupLambda );
267
-
268
- if (this .additionalProperties .get (HEADER_ATTRIBUTES_FLAG ) == null ||
269
- ! (this .additionalProperties .get (HEADER_ATTRIBUTES_FLAG ) instanceof String ) ) {
270
- {
271
- this .additionalProperties .put (HEADER_ATTRIBUTES_FLAG , true );
272
- }
276
+
277
+
278
+ if (additionalProperties .containsKey (HEADER_ATTRIBUTES_FLAG )) {
279
+ this .setHeaderAttributes (convertPropertyToBooleanAndWriteBack (HEADER_ATTRIBUTES_FLAG ));
273
280
} else {
274
- String headerAttributesFlagValue = (String ) this .additionalProperties .get (HEADER_ATTRIBUTES_FLAG );
275
- LOGGER .debug ("asciidoc: header attributes flag..: " + headerAttributesFlagValue );
276
- this .additionalProperties .put (HEADER_ATTRIBUTES_FLAG , "TRUE" .equalsIgnoreCase (headerAttributesFlagValue )); // change attribute in map to type boolean.
281
+ additionalProperties .put (HEADER_ATTRIBUTES_FLAG , headerAttributes );
277
282
}
278
283
}
279
284
0 commit comments