/** * Gets the parent resource of a Resource given its path and the list of * paths available on the API. * * @param paths * The list of paths available on the API. * @param resourcePath * The path of the resource the parent resource is searched for. * @param raml * The RAML representing the API. * @return The parent resource. */ public static Resource getParentResource(List<String> paths, String resourcePath, Raml raml) { List<String> parentPaths = new ArrayList<String>(); parentPaths.addAll(paths); parentPaths.add(resourcePath); Collections.sort(parentPaths); int index = parentPaths.indexOf(resourcePath); if (index != 0) { String parentPath = parentPaths.get(index - 1); if (resourcePath.startsWith(parentPath)) { return getResourceByCompletePath(raml, parentPath); } } return null; }
uiParam.setDisplayName(pathVariable.getName()); uiParam.setDescription(pathVariable.getDescription()); uiParam.setType(RamlUtils.getParamType(pathVariable.getType())); uiParam.setExample(pathVariable.getExample()); ramlResource.getUriParameters().put(pathVariable.getName(), && response.getOutputPayLoad() != null && response.getOutputPayLoad().getType() != null) { if (RamlUtils.isPrimitiveType(response .getOutputPayLoad().getType())) { Property outRepresentationPrimitive = new Property(); .getOutputPayLoad().getType()); SimpleTypeSchema outRepresentationSchema = RamlUtils .generatePrimitiveSchema(outRepresentationPrimitive); try { ramlOutRepresentation RamlUtils.getActionType(operation.getMethod()), action);
array.setRequired(property.isRequired()); array.setUniqueItems(property.isUniqueItems()); if (isPrimitiveType(type)) { Property prop = new Property(); prop.setName(property.getName()); prop.setType(type); array.setItemsSchema(generatePrimitiveSchema(prop)); } else { if (Types.isCompositeType(type)) { type = name + StringUtils.firstUpper(property.getName()); fillSchemas(type, null, false, null, property.getProperties(), schemas, m); } else if (isPrimitiveType(type)) { SimpleTypeSchema primitive = generatePrimitiveSchema(property); primitive.setRequired(property.getMinOccurs() > 0); if (property.getDefaultValue() != null) { type = name + StringUtils.firstUpper(property.getName()); fillSchemas(type, null, false, null, property.getProperties(), schemas, m);
Action action, Operation operation, MimeType ramlInRepresentation) { ramlInRepresentation.setType(operation.getInputPayLoad().getType()); if (RamlUtils.isPrimitiveType(operation.getInputPayLoad().getType())) { Property inRepresentationPrimitive = new Property(); inRepresentationPrimitive.setName(""); .getType()); SimpleTypeSchema inRepresentationSchema = RamlUtils .generatePrimitiveSchema(inRepresentationPrimitive); try { ramlInRepresentation.setSchema(m
raml.getSchemas().add(schemas); for (Representation representation : contract.getRepresentations()) { if (RamlUtils.isPrimitiveType(representation.getName())) { continue; RamlUtils.fillSchemas(representation, schemas, m); } catch (JsonProcessingException e) { LOGGER.log(Level.WARNING,
/** * Generates the JsonSchema of a Representation. * * @param representation * The representation. * @param schemas * @param m * @throws JsonProcessingException */ public static void fillSchemas(Representation representation, Map<String, String> schemas, ObjectMapper m) throws JsonProcessingException { fillSchemas(representation.getName(), representation.getDescription(), representation.isRaw(), representation.getExtendedType(), representation.getProperties(), schemas, m); }
uiParam.setDisplayName(pathVariable.getName()); uiParam.setDescription(pathVariable.getDescription()); uiParam.setType(RamlUtils.getParamType(pathVariable.getType())); uiParam.setExample(pathVariable.getExample()); ramlResource.getUriParameters().put(pathVariable.getName(), && response.getOutputPayLoad() != null && response.getOutputPayLoad().getType() != null) { if (RamlUtils.isPrimitiveType(response .getOutputPayLoad().getType())) { Property outRepresentationPrimitive = new Property(); .getOutputPayLoad().getType()); SimpleTypeSchema outRepresentationSchema = RamlUtils .generatePrimitiveSchema(outRepresentationPrimitive); try { ramlOutRepresentation RamlUtils.getActionType(operation.getMethod()), action);
array.setRequired(property.isRequired()); array.setUniqueItems(property.isUniqueItems()); if (isPrimitiveType(type)) { Property prop = new Property(); prop.setName(property.getName()); prop.setType(type); array.setItemsSchema(generatePrimitiveSchema(prop)); } else { if (Types.isCompositeType(type)) { type = name + StringUtils.firstUpper(property.getName()); fillSchemas(type, null, false, null, property.getProperties(), schemas, m); } else if (isPrimitiveType(type)) { SimpleTypeSchema primitive = generatePrimitiveSchema(property); primitive.setRequired(property.getMinOccurs() > 0); if (property.getDefaultValue() != null) { type = name + StringUtils.firstUpper(property.getName()); fillSchemas(type, null, false, null, property.getProperties(), schemas, m);
Action action, Operation operation, MimeType ramlInRepresentation) { ramlInRepresentation.setType(operation.getInputPayLoad().getType()); if (RamlUtils.isPrimitiveType(operation.getInputPayLoad().getType())) { Property inRepresentationPrimitive = new Property(); inRepresentationPrimitive.setName(""); .getType()); SimpleTypeSchema inRepresentationSchema = RamlUtils .generatePrimitiveSchema(inRepresentationPrimitive); try { ramlInRepresentation.setSchema(m
raml.getSchemas().add(schemas); for (Representation representation : contract.getRepresentations()) { if (RamlUtils.isPrimitiveType(representation.getName())) { continue; RamlUtils.fillSchemas(representation, schemas, m); } catch (JsonProcessingException e) { LOGGER.log(Level.WARNING,
/** * Generates the JsonSchema of a Representation. * * @param representation * The representation. * @param schemas * @param m * @throws JsonProcessingException */ public static void fillSchemas(Representation representation, Map<String, String> schemas, ObjectMapper m) throws JsonProcessingException { fillSchemas(representation.getName(), representation.getDescription(), representation.isRaw(), representation.getExtendedType(), representation.getProperties(), schemas, m); }
uiParam.setDisplayName(pathVariable.getName()); uiParam.setDescription(pathVariable.getDescription()); uiParam.setType(RamlUtils.getParamType(pathVariable.getType())); uiParam.setExample(pathVariable.getExample()); ramlResource.getUriParameters().put(pathVariable.getName(), && response.getOutputPayLoad() != null && response.getOutputPayLoad().getType() != null) { if (RamlUtils.isPrimitiveType(response .getOutputPayLoad().getType())) { Property outRepresentationPrimitive = new Property(); .getOutputPayLoad().getType()); SimpleTypeSchema outRepresentationSchema = RamlUtils .generatePrimitiveSchema(outRepresentationPrimitive); try { ramlOutRepresentation RamlUtils.getActionType(operation.getMethod()), action);
array.setRequired(property.isRequired()); array.setUniqueItems(property.isUniqueItems()); if (isPrimitiveType(type)) { Property prop = new Property(); prop.setName(property.getName()); prop.setType(type); array.setItemsSchema(generatePrimitiveSchema(prop)); } else { if (Types.isCompositeType(type)) { type = name + StringUtils.firstUpper(property.getName()); fillSchemas(type, null, false, null, property.getProperties(), schemas, m); } else if (isPrimitiveType(type)) { SimpleTypeSchema primitive = generatePrimitiveSchema(property); primitive.setRequired(property.getMinOccurs() > 0); if (property.getDefaultValue() != null) { type = name + StringUtils.firstUpper(property.getName()); fillSchemas(type, null, false, null, property.getProperties(), schemas, m);
Action action, Operation operation, MimeType ramlInRepresentation) { ramlInRepresentation.setType(operation.getInputPayLoad().getType()); if (RamlUtils.isPrimitiveType(operation.getInputPayLoad().getType())) { Property inRepresentationPrimitive = new Property(); inRepresentationPrimitive.setName(""); .getType()); SimpleTypeSchema inRepresentationSchema = RamlUtils .generatePrimitiveSchema(inRepresentationPrimitive); try { ramlInRepresentation.setSchema(m
raml.getSchemas().add(schemas); for (Representation representation : contract.getRepresentations()) { if (RamlUtils.isPrimitiveType(representation.getName())) { continue; RamlUtils.fillSchemas(representation, schemas, m); } catch (JsonProcessingException e) { LOGGER.log(Level.WARNING,
/** * Generates the JsonSchema of a Representation. * * @param representation * The representation. * @param schemas * @param m * @throws JsonProcessingException */ public static void fillSchemas(Representation representation, Map<String, String> schemas, ObjectMapper m) throws JsonProcessingException { fillSchemas(representation.getName(), representation.getDescription(), representation.isRaw(), representation.getExtendedType(), representation.getProperties(), schemas, m); }
/** * Gets the parent resource of a Resource given its path and the list of * paths available on the API. * * @param paths * The list of paths available on the API. * @param resourcePath * The path of the resource the parent resource is searched for. * @param raml * The RAML representing the API. * @return The parent resource. */ public static Resource getParentResource(List<String> paths, String resourcePath, Raml raml) { List<String> parentPaths = new ArrayList<String>(); parentPaths.addAll(paths); parentPaths.add(resourcePath); Collections.sort(parentPaths); int index = parentPaths.indexOf(resourcePath); if (index != 0) { String parentPath = parentPaths.get(index - 1); if (resourcePath.startsWith(parentPath)) { return getResourceByCompletePath(raml, parentPath); } } return null; }
uiParam.setDisplayName(pathVariable.getName()); uiParam.setDescription(pathVariable.getDescription()); uiParam.setType(RamlUtils.getParamType(pathVariable.getType())); uiParam.setExample(pathVariable.getExample()); ramlResource.getUriParameters().put(pathVariable.getName(), && response.getOutputPayLoad() != null && response.getOutputPayLoad().getType() != null) { if (RamlUtils.isPrimitiveType(response .getOutputPayLoad().getType())) { Property outRepresentationPrimitive = new Property(); .getOutputPayLoad().getType()); SimpleTypeSchema outRepresentationSchema = RamlUtils .generatePrimitiveSchema(outRepresentationPrimitive); try { ramlOutRepresentation RamlUtils.getActionType(operation.getMethod()), action);
array.setRequired(property.isRequired()); array.setUniqueItems(property.isUniqueItems()); if (isPrimitiveType(type)) { Property prop = new Property(); prop.setName(property.getName()); prop.setType(type); array.setItemsSchema(generatePrimitiveSchema(prop)); } else { if (Types.isCompositeType(type)) { type = name + StringUtils.firstUpper(property.getName()); fillSchemas(type, null, false, null, property.getProperties(), schemas, m); } else if (isPrimitiveType(type)) { SimpleTypeSchema primitive = generatePrimitiveSchema(property); primitive.setRequired(property.getMinOccurs() > 0); if (property.getDefaultValue() != null) { type = name + StringUtils.firstUpper(property.getName()); fillSchemas(type, null, false, null, property.getProperties(), schemas, m);
Action action, Operation operation, MimeType ramlInRepresentation) { ramlInRepresentation.setType(operation.getInputPayLoad().getType()); if (RamlUtils.isPrimitiveType(operation.getInputPayLoad().getType())) { Property inRepresentationPrimitive = new Property(); inRepresentationPrimitive.setName(""); .getType()); SimpleTypeSchema inRepresentationSchema = RamlUtils .generatePrimitiveSchema(inRepresentationPrimitive); try { ramlInRepresentation.setSchema(m