Example usage for com.fasterxml.jackson.databind.node JsonNodeType STRING

List of usage examples for com.fasterxml.jackson.databind.node JsonNodeType STRING

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind.node JsonNodeType STRING.

Prototype

JsonNodeType STRING

To view the source code for com.fasterxml.jackson.databind.node JsonNodeType STRING.

Click Source Link

Usage

From source file:io.swagger.v3.parser.util.OpenAPIDeserializer.java

public List<String> getTagsStrings(ArrayNode nodes, String location, ParseResult result) {
    if (nodes == null)
        return null;

    List<String> tags = new ArrayList<>();

    for (JsonNode node : nodes) {
        if (node.getNodeType().equals(JsonNodeType.STRING)) {
            tags.add(node.textValue());//ww w.j  a va  2s  .c om
        }
    }
    return tags;
}

From source file:io.swagger.v3.parser.util.OpenAPIDeserializer.java

protected RequestBody getRequestBody(ObjectNode node, String location, ParseResult result) {
    if (node == null) {
        return null;
    }/*from   www  . jav  a  2s. c  om*/
    final RequestBody body = new RequestBody();

    JsonNode ref = node.get("$ref");
    if (ref != null) {
        if (ref.getNodeType().equals(JsonNodeType.STRING)) {
            String mungedRef = mungedRef(ref.textValue());
            if (mungedRef != null) {
                body.set$ref(mungedRef);
            } else {
                body.set$ref(ref.textValue());
            }
            return body;
        } else {
            result.invalidType(location, "$ref", "string", node);
            return null;
        }
    }

    final String description = getString("description", node, false, location, result);
    if (StringUtils.isNotBlank(description)) {
        body.setDescription(description);
    }

    final Boolean required = getBoolean("required", node, false, location, result);
    if (required != null) {
        body.setRequired(required);
    }

    final ObjectNode contentNode = getObject("content", node, true, location, result);
    if (contentNode != null) {
        body.setContent(getContent(contentNode, location + ".content", result));
    }

    Map<String, Object> extensions = getExtensions(node);
    if (extensions != null && extensions.size() > 0) {
        body.setExtensions(extensions);
    }

    Set<String> keys = getKeys(node);
    for (String key : keys) {
        if (!REQUEST_BODY_KEYS.contains(key) && !key.startsWith("x-")) {
            result.extra(location, key, node.get(key));
        }
    }

    return body;
}