forked from loafle/openapi-generator-original
Bugfix #17149: Asciidoc generator sets not defined example values wrongly to the string value "null" instead of the expected not set value (#20670)
Co-authored-by: Karsten Leonhardt <karsten.leonhardt@commerzbank.com>
This commit is contained in:
parent
a6280d9b58
commit
c5863629c0
@ -16,8 +16,10 @@
|
|||||||
|
|
||||||
package org.openapitools.codegen.languages;
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.media.Schema;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import io.swagger.v3.oas.models.media.Schema;
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -326,6 +328,27 @@ public class AsciidocDocumentationCodegen extends DefaultCodegen implements Code
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// override to avoid printing of string "null"
|
||||||
|
// when no example exists
|
||||||
|
@Override
|
||||||
|
public String toExampleValue(Schema schema) {
|
||||||
|
if (schema.getExample() != null) {
|
||||||
|
return schema.getExample().toString();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Avoid additional escapes of \ -> \\, " -> \"
|
||||||
|
// in regular expressions that are
|
||||||
|
// introduced by the `escapeText` method.
|
||||||
|
// Note: We don't need this here since we want to print
|
||||||
|
// the plain regular expression
|
||||||
|
// Therefore, override this method to skip `escapeText`.
|
||||||
|
@Override
|
||||||
|
public String toRegularExpression(String pattern) {
|
||||||
|
return addRegularExpressionDelimiter(pattern);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void processOpenAPI(OpenAPI openAPI) {
|
public void processOpenAPI(OpenAPI openAPI) {
|
||||||
if (this.includeSpecMarkupLambda != null) {
|
if (this.includeSpecMarkupLambda != null) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user