/** * Constructs a singular resource (referenced by type) * @param definitionName The swagger model to reference in 'data'. * @param included Whether or not to add the 'included' property to the schema. */ public Datum(String definitionName, boolean included) { super(); property("data", new RefProperty(definitionName)); if (included) { property("included", new ArrayProperty() .description("Included resources") .uniqueItems() .items(new IncludedResource()) ); } }
/** * Used to construct a collection of resources (referenced by the resource type) * @param definitionName The swagger model to reference in 'data' * @param included Whether or not to add the 'included' property to the schema. */ public Data(String definitionName, boolean included) { super(); property("data", new ArrayProperty().items(new RefProperty(definitionName))); if (included) { property("included", new ArrayProperty() .description("Included resources") .uniqueItems() .items(new IncludedResource()) ); } }
return property .example(annotation.example()) .description(annotation.value());
private static Map<String, Property> initProperties() { Map<String, Property> properties = new LinkedHashMap<>(); properties.put(PROPERTY_ONE_NAME, new StringProperty() .example(PROPERTY_ONE_EXAMPLE) .required(true) .description(PROPERTY_ONE_DESCRIPTION)); properties.put(PROPERTY_TWO_NAME, new StringProperty() .example(PROPERTY_TWO_EXAMPLE) .required(true) .description(PROPERTY_TWO_DESCRIPTION)); IntegerProperty integerProp = new IntegerProperty(); LongProperty longProp = new LongProperty(); BooleanProperty booleanProp = new BooleanProperty(); integerProp.setExample(""); longProp.setExample(""); booleanProp.setExample(""); properties.put(ARRAY_PROP_NAME, new ArrayProperty().example("").description("")); properties.put(DOUBLE_PROP_NAME, new DoubleProperty().example("").description("")); properties.put(FLOAT_PROP_NAME, new FloatProperty().example("").description("")); properties.put(INTEGER_PROP_NAME, integerProp.description("")); properties.put(LONG_PROP_NAME, longProp.description("")); properties.put(BOOLEAN_PROP_NAME, booleanProp.description("")); properties.put(OBJECT_PROP_NAME, new ObjectProperty().example("").description("")); return properties; } }