Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

package org.openapitools.codegen.languages;

import io.swagger.v3.oas.models.media.Schema;
import lombok.Getter;
import lombok.Setter;
import io.swagger.v3.oas.models.media.Schema;
import org.openapitools.codegen.*;

import java.io.File;
Expand Down Expand Up @@ -326,6 +328,27 @@ private void processBooleanFlag(String flag, boolean value) {
}
}

// 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
public void processOpenAPI(OpenAPI openAPI) {
if (this.includeSpecMarkupLambda != null) {
Expand Down
Loading