type = new ObjectType(property.getTitle(), ((ObjectProperty) property).getProperties()); } else if (property instanceof IntegerProperty) { IntegerProperty integerProperty = (IntegerProperty) property; type = new BasicType(integerProperty.getType(), integerProperty.getTitle(), integerProperty.getFormat()); } else { type = new BasicType(property.getType(), property.getTitle()); return null; } else if (isNotBlank(property.getFormat())) { type = new BasicType(property.getType(), property.getTitle(), property.getFormat()); } else { type = new BasicType(property.getType(), property.getTitle());
private static String determineTitleOf(final String name, final Property schema) { final String title = schema.getTitle(); if (title != null) { return title; } final String description = schema.getDescription(); if (description != null) { return description; } final String reference = determineSchemaReference(schema); if (reference != null) { return reference.replaceAll("^.*/", ""); } return name; }
private static String determineTitleOf(final String name, final Property schema) { final String title = schema.getTitle(); if (title != null) { return title; } final String description = schema.getDescription(); if (description != null) { return description; } final String reference = JsonSchemaHelper.determineSchemaReference(schema); if (reference != null) { return reference.replaceAll("^.*/", ""); } return name; }
private static JsonNode createSchemaFromProperty(final String specification, final Property schema) { if (schema instanceof MapProperty) { try { final String schemaString = Json.writer().writeValueAsString(schema); return parseJsonSchema(schemaString); } catch (final JsonProcessingException e) { throw new IllegalStateException("Unable to serialize/read given JSON specification in response schema: " + schema, e); } } else if (schema instanceof StringProperty) { return null; } final String reference = determineSchemaReference(schema); final String title = Optional.ofNullable(schema.getTitle()).orElse(reference.replaceAll("^.*/", "")); return createSchemaFromReference(specification, title, reference); }
private static JsonNode createSchemaFromProperty(final String specification, final Property schema) { if (schema instanceof MapProperty) { try { final String schemaString = Json.mapper().writeValueAsString(schema); return parseJsonSchema(schemaString); } catch (final JsonProcessingException e) { throw new IllegalStateException("Unable to serialize/read given JSON specification in response schema: " + schema, e); } } else if (schema instanceof StringProperty) { return null; } final String reference = determineSchemaReference(schema); final String title = Optional.ofNullable(schema.getTitle()).orElse(reference.replaceAll("^.*/", "")); return createSchemaFromReference(specification, title, reference); }
private static DataShape createShapeFromProperty(final String specification, final Property schema) { if (schema instanceof MapProperty) { try { final String schemaString = Json.writer().writeValueAsString(schema); return new DataShape.Builder().kind(DataShapeKinds.JSON_SCHEMA).specification(schemaString).build(); } catch (final JsonProcessingException e) { throw new IllegalStateException("Unable to serialize given JSON specification in response schema: " + schema, e); } } else if (schema instanceof StringProperty) { return DATA_SHAPE_NONE; } final String reference = determineSchemaReference(schema); final String title = Optional.ofNullable(schema.getTitle()).orElse(reference.replaceAll("^.*/", "")); return createShapeFromReference(specification, title, reference); }
private static DataShape createShapeFromProperty(final String specification, final Property schema) { if (schema instanceof MapProperty) { try { final String schemaString = Json.mapper().writeValueAsString(schema); return new DataShape.Builder().kind("json-schema").specification(schemaString).build(); } catch (final JsonProcessingException e) { throw new IllegalStateException("Unable to serialize given JSON specification in response schema: " + schema, e); } } else if (schema instanceof StringProperty) { return DATA_SHAPE_NONE; } final String reference = determineSchemaReference(schema); final String title = Optional.ofNullable(schema.getTitle()).orElse(reference.replaceAll("^.*/", "")); return createShapeFromReference(specification, title, reference); }
type = new ObjectType(property.getTitle(), ((ObjectProperty) property).getProperties()); } else { if (property.getType() == null) { return null; } else if (isNotBlank(property.getFormat())) { type = new BasicType(property.getType(), property.getTitle(), property.getFormat()); } else { type = new BasicType(property.getType(), property.getTitle());