Search in sources :

Example 1 with ParameterName

use of com.palantir.conjure.parser.services.ParameterName in project conjure by palantir.

the class ConjureParserUtils method parseArgs.

private static List<ArgumentDefinition> parseArgs(Map<ParameterName, com.palantir.conjure.parser.services.ArgumentDefinition> args, HttpPath httpPath, ReferenceTypeResolver typeResolver) {
    ImmutableList.Builder<ArgumentDefinition> resultBuilder = ImmutableList.builder();
    for (Map.Entry<ParameterName, com.palantir.conjure.parser.services.ArgumentDefinition> entry : args.entrySet()) {
        com.palantir.conjure.parser.services.ArgumentDefinition original = entry.getValue();
        ArgumentName argName = ArgumentName.of(entry.getKey().name());
        ParameterType paramType = parseParameterType(original, argName, httpPath);
        ArgumentDefinition.Builder builder = ArgumentDefinition.builder().argName(argName).type(original.type().visit(new ConjureTypeParserVisitor(typeResolver))).paramType(paramType).docs(original.docs().map(Documentation::of)).safety(original.safety().map(ConjureParserUtils::parseLogSafety)).markers(parseMarkers(original.markers(), typeResolver)).tags(original.tags().stream().peek(tag -> Preconditions.checkArgument(!tag.isEmpty(), "tag must not be empty")).collect(Collectors.toSet()));
        resultBuilder.add(builder.build());
    }
    return resultBuilder.build();
}
Also used : BodyParameterType(com.palantir.conjure.spec.BodyParameterType) ParameterType(com.palantir.conjure.spec.ParameterType) PathParameterType(com.palantir.conjure.spec.PathParameterType) QueryParameterType(com.palantir.conjure.spec.QueryParameterType) HeaderParameterType(com.palantir.conjure.spec.HeaderParameterType) ImmutableList(com.google.common.collect.ImmutableList) Documentation(com.palantir.conjure.spec.Documentation) ArgumentDefinition(com.palantir.conjure.spec.ArgumentDefinition) ParameterName(com.palantir.conjure.parser.services.ParameterName) Map(java.util.Map) HashMap(java.util.HashMap) ArgumentName(com.palantir.conjure.spec.ArgumentName)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ParameterName (com.palantir.conjure.parser.services.ParameterName)1 ArgumentDefinition (com.palantir.conjure.spec.ArgumentDefinition)1 ArgumentName (com.palantir.conjure.spec.ArgumentName)1 BodyParameterType (com.palantir.conjure.spec.BodyParameterType)1 Documentation (com.palantir.conjure.spec.Documentation)1 HeaderParameterType (com.palantir.conjure.spec.HeaderParameterType)1 ParameterType (com.palantir.conjure.spec.ParameterType)1 PathParameterType (com.palantir.conjure.spec.PathParameterType)1 QueryParameterType (com.palantir.conjure.spec.QueryParameterType)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1