Search in sources :

Example 1 with ConjurePackage

use of com.palantir.conjure.parser.types.names.ConjurePackage in project conjure by palantir.

the class ConjureParserUtils method parseErrors.

static List<ErrorDefinition> parseErrors(NamedTypesDefinition defs, ConjureTypeParserVisitor.ReferenceTypeResolver typeResolver) {
    Optional<String> defaultPackage = defs.defaultConjurePackage().map(ConjurePackage::name);
    ImmutableList.Builder<ErrorDefinition> errorsBuidler = ImmutableList.builder();
    errorsBuidler.addAll(defs.errors().entrySet().stream().map(entry -> {
        TypeName typeName = TypeName.of(entry.getKey().name(), parsePackageOrElseThrow(entry.getValue().conjurePackage(), defaultPackage));
        return parseErrorType(typeName, entry.getValue(), typeResolver);
    }).collect(Collectors.toList()));
    return errorsBuidler.build();
}
Also used : ErrorDefinition(com.palantir.conjure.spec.ErrorDefinition) TypeName(com.palantir.conjure.spec.TypeName) ImmutableList(com.google.common.collect.ImmutableList) ConjurePackage(com.palantir.conjure.parser.types.names.ConjurePackage) PathString(com.palantir.conjure.parser.services.PathString)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 PathString (com.palantir.conjure.parser.services.PathString)1 ConjurePackage (com.palantir.conjure.parser.types.names.ConjurePackage)1 ErrorDefinition (com.palantir.conjure.spec.ErrorDefinition)1 TypeName (com.palantir.conjure.spec.TypeName)1