use of io.swagger.v3.oas.annotations.ExternalDocumentation in project swagger-core by swagger-api.
the class ModelResolver method resolveExternalDocumentation.
protected ExternalDocumentation resolveExternalDocumentation(io.swagger.v3.oas.annotations.ExternalDocumentation externalDocumentation) {
if (externalDocumentation == null) {
return null;
}
boolean isEmpty = true;
ExternalDocumentation external = new ExternalDocumentation();
if (StringUtils.isNotBlank(externalDocumentation.description())) {
isEmpty = false;
external.setDescription(externalDocumentation.description());
}
if (StringUtils.isNotBlank(externalDocumentation.url())) {
isEmpty = false;
external.setUrl(externalDocumentation.url());
}
if (isEmpty) {
return null;
}
return external;
}
use of io.swagger.v3.oas.annotations.ExternalDocumentation in project swagger-core by swagger-api.
the class ModelResolver method resolveSchemaMembers.
protected void resolveSchemaMembers(Schema schema, Annotated a, Annotation[] annotations, io.swagger.v3.oas.annotations.media.Schema schemaAnnotation) {
String description = resolveDescription(a, annotations, schemaAnnotation);
if (StringUtils.isNotBlank(description)) {
schema.description(description);
}
String title = resolveTitle(a, annotations, schemaAnnotation);
if (StringUtils.isNotBlank(title)) {
schema.title(title);
}
String format = resolveFormat(a, annotations, schemaAnnotation);
if (StringUtils.isNotBlank(format) && StringUtils.isBlank(schema.getFormat())) {
schema.format(format);
}
Object defaultValue = resolveDefaultValue(a, annotations, schemaAnnotation);
if (defaultValue != null) {
schema.setDefault(defaultValue);
}
Object example = resolveExample(a, annotations, schemaAnnotation);
if (example != null) {
schema.example(example);
}
Boolean readOnly = resolveReadOnly(a, annotations, schemaAnnotation);
if (readOnly != null) {
schema.readOnly(readOnly);
}
Boolean nullable = resolveNullable(a, annotations, schemaAnnotation);
if (nullable != null) {
schema.nullable(nullable);
}
BigDecimal multipleOf = resolveMultipleOf(a, annotations, schemaAnnotation);
if (multipleOf != null) {
schema.multipleOf(multipleOf);
}
Integer maxLength = resolveMaxLength(a, annotations, schemaAnnotation);
if (maxLength != null) {
schema.maxLength(maxLength);
}
Integer minLength = resolveMinLength(a, annotations, schemaAnnotation);
if (minLength != null) {
schema.minLength(minLength);
}
BigDecimal minimum = resolveMinimum(a, annotations, schemaAnnotation);
if (minimum != null) {
schema.minimum(minimum);
}
BigDecimal maximum = resolveMaximum(a, annotations, schemaAnnotation);
if (maximum != null) {
schema.maximum(maximum);
}
Boolean exclusiveMinimum = resolveExclusiveMinimum(a, annotations, schemaAnnotation);
if (exclusiveMinimum != null) {
schema.exclusiveMinimum(exclusiveMinimum);
}
Boolean exclusiveMaximum = resolveExclusiveMaximum(a, annotations, schemaAnnotation);
if (exclusiveMaximum != null) {
schema.exclusiveMaximum(exclusiveMaximum);
}
String pattern = resolvePattern(a, annotations, schemaAnnotation);
if (StringUtils.isNotBlank(pattern)) {
schema.pattern(pattern);
}
Integer minProperties = resolveMinProperties(a, annotations, schemaAnnotation);
if (minProperties != null) {
schema.minProperties(minProperties);
}
Integer maxProperties = resolveMaxProperties(a, annotations, schemaAnnotation);
if (maxProperties != null) {
schema.maxProperties(maxProperties);
}
List<String> requiredProperties = resolveRequiredProperties(a, annotations, schemaAnnotation);
if (requiredProperties != null) {
for (String prop : requiredProperties) {
addRequiredItem(schema, prop);
}
}
Boolean writeOnly = resolveWriteOnly(a, annotations, schemaAnnotation);
if (writeOnly != null) {
schema.writeOnly(writeOnly);
}
ExternalDocumentation externalDocs = resolveExternalDocumentation(a, annotations, schemaAnnotation);
if (externalDocs != null) {
schema.externalDocs(externalDocs);
}
Boolean deprecated = resolveDeprecated(a, annotations, schemaAnnotation);
if (deprecated != null) {
schema.deprecated(deprecated);
}
List<String> allowableValues = resolveAllowableValues(a, annotations, schemaAnnotation);
if (allowableValues != null) {
for (String prop : allowableValues) {
schema.addEnumItemObject(prop);
}
}
Map<String, Object> extensions = resolveExtensions(a, annotations, schemaAnnotation);
if (extensions != null) {
extensions.forEach(schema::addExtension);
}
}
Aggregations