Package com.github.kongchen.swagger.docgen.remote.model

Examples of com.github.kongchen.swagger.docgen.remote.model.JParameter


         private JAllowableValues allowableValues;
         private String paramType;
         private String paramAccess;
         */
        JsonNode node = jp.readValueAsTree();//jp.getCodec().readTree(jp)
        JParameter parameter = new JParameter();
        parameter.setName(Utils.getStringFromJsonNode(node, "name"));
        parameter.setDescription(Utils.getStringFromJsonNode(node, "description"));
        parameter.setDefaultValue(Utils.getStringFromJsonNode(node, "defaultValue"));
        parameter.setRequired(Utils.getBooleanFromJsonNode(node, "required"));
        parameter.setAllowMultiple(Utils.getBooleanFromJsonNode(node, "allowMultiple"));
        String type = Utils.getStringFromJsonNode(node, "type");
        String format = Utils.getStringFromJsonNode(node, "format");
        parameter.setDataType(SwaggerSerializers.fromJsonSchemaType(new Tuple2<String, String>(type, format)));

        JsonNode jsonNode = node.get("items");
        if (jsonNode != null) {
            JModelRef items = jsonNode.traverse(jp.getCodec()).readValueAs(JModelRef.class);

            if ("array".equalsIgnoreCase(type)) {
                if (Utils.getBooleanFromJsonNode(node, "uniqueItems")) {
                    parameter.setDataType("Set["+items.getRef()+"]");
                } else {
                    parameter.setDataType("List["+items.getRef()+"]");
                }
            }
        }

        parameter.setAllowableValues(Utils.getAllowableValuesFromJsonNode(node));
        parameter.setParamType(Utils.getStringFromJsonNode(node, "paramType"));
        parameter.setParamAccess(Utils.getStringFromJsonNode(node, "paramAccess"));
        return parameter;
    }
View Full Code Here

TOP

Related Classes of com.github.kongchen.swagger.docgen.remote.model.JParameter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.