@Override public String getTypeDeclaration(Property p) { if ("password".equals(p.getFormat())) { return "char[]"; } if (p instanceof ArrayProperty) { ArrayProperty ap = (ArrayProperty) p; Property inner = ap.getItems(); if (inner == null) { // mimic super behavior log.warn("{} (array property) does not have a proper inner type defined", ap.getName()); return null; } String type = super.getTypeDeclaration(inner); if (!languageSpecificPrimitives.contains(type) && topLevelResources.contains(type)) { return type + "List"; } } return super.getTypeDeclaration(p); }
private static Element createResponseBodySchema(final Swagger swagger, final Operation operation, final Map<String, SchemaPrefixAndElement> moreSchemas) { final Optional<Response> maybeResponse = findResponse(operation); if (!maybeResponse.isPresent()) { return null; } final Response body = maybeResponse.get(); final Property bodySchema = body.getSchema(); if (bodySchema instanceof RefProperty) { return defineComplexElement((RefProperty) bodySchema, null, swagger, moreSchemas); } else if (bodySchema instanceof ArrayProperty) { final ArrayProperty array = (ArrayProperty) bodySchema; final String targetNamespace = xmlTargetNamespaceOrNull(array); final Element schema = newXmlSchema(targetNamespace); defineElementProperty(ofNullable(array.getName()).orElse("array"), array, schema, swagger, moreSchemas); return schema; } else { throw new IllegalArgumentException("Unsupported response schema type: " + bodySchema); } }
private static Element createResponseBodySchema(final Swagger swagger, final Operation operation, final Map<String, SchemaPrefixAndElement> moreSchemas) { final Optional<Response> maybeResponse = findResponse(operation); if (!maybeResponse.isPresent()) { return null; } final Response body = maybeResponse.get(); final Property bodySchema = body.getSchema(); if (bodySchema instanceof RefProperty) { return defineComplexElement((RefProperty) bodySchema, null, swagger, moreSchemas); } else if (bodySchema instanceof ArrayProperty) { final ArrayProperty array = (ArrayProperty) bodySchema; final String targetNamespace = XmlSchemaHelper.xmlTargetNamespaceOrNull(array); final Element schema = XmlSchemaHelper.newXmlSchema(targetNamespace); defineElementProperty(ofNullable(array.getName()).orElse("array"), array, schema, swagger, moreSchemas); return schema; } else { throw new IllegalArgumentException("Unsupported response schema type: " + bodySchema); } }
private static Element createResponseBodySchema(final Swagger swagger, final Operation operation, final Map<String, SchemaPrefixAndElement> moreSchemas) { final Optional<Response> maybeResponse = findResponse(operation); if (!maybeResponse.isPresent()) { return null; } final Response body = maybeResponse.get(); final Property bodySchema = body.getSchema(); if (bodySchema instanceof RefProperty) { return defineComplexElement((RefProperty) bodySchema, null, swagger, moreSchemas); } else if (bodySchema instanceof ArrayProperty) { final ArrayProperty array = (ArrayProperty) bodySchema; final String targetNamespace = xmlTargetNamespaceOrNull(array); final Element schema = newXmlSchema(targetNamespace); defineElementProperty(ofNullable(array.getName()).orElse("array"), array, schema, swagger, moreSchemas); return schema; } else { throw new IllegalArgumentException("Unsupported response schema type: " + bodySchema); } }