@Test(description = "it should not create an xml object for $ref") public void shouldNotCreateXmlObjectForRef() throws IOException { final Schema model = new Schema().$ref("Monster"); model.setDescription("oops"); model.setExternalDocs(new ExternalDocumentation() .description("external docs") .url("http://swagger.io")); assertEquals(Json.mapper().writeValueAsString(model), "{\"$ref\":\"#/components/schemas/Monster\"}"); }
schemaObject.setDescription(schema.description());
private void injectApiVersionToDefinitions(Map<String, Schema> schemas, BiFunction<String, String, String> replacer) { if (schemas != null) { schemas.forEach((name, schema) -> { schema.setDescription(replacer.apply(schema.getDescription(), apiVersion.get())); Map<String, Schema> properties = schema.getProperties(); if (properties != null) { properties.forEach((propName, prop) -> prop.setDescription(replacer.apply(prop.getDescription(), apiVersion.get()))); } }); } }
private void overrideWithVersionedPropertyDescription(Schema propertySchema, Annotation ann, String dialect) { VersionedProperty[] props = ((VersionedProperties) ann).value(); Optional<VersionedProperty> matchedProp = Arrays.stream(props) .filter(prop -> dialect.equals(prop.dialect())) .findFirst(); matchedProp.ifPresent(prop -> { String desc = prop.description(); propertySchema.setDescription(desc); }); } }
private Header convertHeader(Property property) { Schema schema = convert(property); schema.setDescription(null); Header header = new Header(); header.setDescription(property.getDescription()); header.setSchema(schema); return header; }
private Header convertHeader(Property property) { Schema schema = convert(property); schema.setDescription(null); Header header = new Header(); header.setDescription(property.getDescription()); header.setSchema(schema); return header; }
private Header convertHeader(Property property) { Schema schema = convert(property); schema.setDescription(null); Header header = new Header(); header.setDescription(property.getDescription()); header.setSchema(schema); return header; }
propertySchema.setDescription(descriptionFromAnnotation);
public void preprocessOpenAPI(OpenAPI openAPI) { Info info = openAPI.getInfo(); info.setDescription(toHtml(info.getDescription())); info.setTitle(toHtml(info.getTitle())); Map<String, Schema> models = openAPI.getComponents().getSchemas(); for (Schema model : models.values()) { model.setDescription(toHtml(model.getDescription())); model.setTitle(toHtml(model.getTitle())); } }
Schema schema = schemaMap.get(name); if (StringUtils.isNotBlank(schema.getDescription())) { schema.setDescription(preserveNewlines(schema.getDescription(), 1)); Schema propertySchema = propertiesMap.get(propertyName); if (StringUtils.isNotBlank(propertySchema.getDescription())) { propertySchema.setDescription(preserveNewlines(propertySchema.getDescription(), 2));
public Schema modelFromProperty(ObjectSchema object, String path) { String description = object.getDescription(); String example = null; Object obj = object.getExample(); if (obj != null) { example = obj.toString(); } String name = object.getName(); XML xml = object.getXml(); Map<String, Schema> properties = object.getProperties(); Schema model = new Schema();//TODO Verify this! model.setDescription(description); model.setExample(example); model.setName(name); model.setXml(xml); model.setType(object.getType()); if (properties != null) { flattenProperties(properties, path); model.setProperties(properties); } return model; }
public void preprocessOpenAPI(OpenAPI openAPI) { Info info = openAPI.getInfo(); info.setDescription(toHtml(info.getDescription())); info.setTitle(toHtml(info.getTitle())); if (openAPI.getComponents() == null || openAPI.getComponents().getSchemas() == null) { return; } Map<String, Schema> schemas = openAPI.getComponents().getSchemas(); for (Schema schema : schemas.values()) { schema.setDescription(toHtml(schema.getDescription())); schema.setTitle(toHtml(schema.getTitle())); } }
public Schema modelFromProperty(ObjectSchema object, String path) { String description = object.getDescription(); String example = null; Object obj = object.getExample(); if (obj != null) { example = obj.toString(); } String name = object.getName(); XML xml = object.getXml(); Map<String, Schema> properties = object.getProperties(); Schema model = new Schema();//TODO Verify this! model.setDescription(description); model.setExample(example); model.setName(name); model.setXml(xml); model.setType(object.getType()); if (properties != null) { flattenProperties(properties, path); model.setProperties(properties); } return model; }
public Schema modelFromProperty(ObjectSchema object, String path) { String description = object.getDescription(); String example = null; Object obj = object.getExample(); if (obj != null) { example = obj.toString(); } String name = object.getName(); XML xml = object.getXml(); Map<String, Schema> properties = object.getProperties(); Schema model = new Schema();//TODO Verify this! model.setDescription(description); model.setExample(example); model.setName(name); model.setXml(xml); model.setType(object.getType()); if (properties != null) { flattenProperties(properties, path); model.setProperties(properties); } return model; }
public Schema modelFromProperty(ObjectSchema object, String path) { String description = object.getDescription(); String example = null; Object obj = object.getExample(); if (obj != null) { example = obj.toString(); } XML xml = object.getXml(); Map<String, Schema> properties = object.getProperties(); Schema model = new Schema(); model.setDescription(description); model.setExample(example); model.setName(object.getName()); model.setXml(xml); model.setRequired(object.getRequired()); if (properties != null) { flattenProperties(properties, path); model.setProperties(properties); } return model; }
public void preprocessOpenAPI(OpenAPI openAPI) { super.preprocessOpenAPI(openAPI); Info info = openAPI.getInfo(); info.setDescription(toHtml(info.getDescription())); info.setTitle(toHtml(info.getTitle())); if (openAPI.getComponents() == null || openAPI.getComponents().getSchemas() == null) { return; } Map<String, Schema> schemas = openAPI.getComponents().getSchemas(); for (Schema schema : schemas.values()) { schema.setDescription(toHtml(schema.getDescription())); schema.setTitle(toHtml(schema.getTitle())); } }
schema.setDescription(sp.getDescription()); schema.setReadOnly(sp.isReadOnly()); schema.setEnum(sp.getEnum());
schema.setDescription(sp.getDescription()); schema.setReadOnly(sp.isReadOnly()); schema.setEnum(sp.getEnum());
schema.setDescription(sp.getDescription()); schema.setReadOnly(sp.isReadOnly()); schema.setEnum(sp.getEnum());
property.setDescription(queryParameter.getDescription()); addInternalExtensionToSchema(property, VEN_FROM_QUERY, Boolean.TRUE);