Search in sources :

Example 1 with PathString

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

the class ConjureParserUtils method parseEndpoint.

private static EndpointDefinition parseEndpoint(String name, com.palantir.conjure.parser.services.EndpointDefinition def, PathString basePath, Optional<AuthType> defaultAuth, ReferenceTypeResolver typeResolver, DealiasingTypeVisitor dealiasingVisitor) {
    HttpPath httpPath = parseHttpPath(def, basePath);
    EndpointDefinition endpoint = EndpointDefinition.builder().endpointName(EndpointName.of(name)).httpMethod(HttpMethod.valueOf(def.http().method())).httpPath(httpPath).auth(def.auth().map(ConjureParserUtils::parseAuthType).orElse(defaultAuth)).args(parseArgs(def.args(), httpPath, typeResolver)).tags(def.tags().stream().peek(tag -> Preconditions.checkArgument(!tag.isEmpty(), "tag must not be empty")).collect(Collectors.toSet())).markers(parseMarkers(def.markers(), typeResolver)).returns(def.returns().map(t -> t.visit(new ConjureTypeParserVisitor(typeResolver)))).docs(def.docs().map(Documentation::of)).deprecated(def.deprecated().map(Documentation::of)).build();
    EndpointDefinitionValidator.validateAll(endpoint, dealiasingVisitor);
    return endpoint;
}
Also used : HeaderAuthType(com.palantir.conjure.spec.HeaderAuthType) PathString(com.palantir.conjure.parser.services.PathString) SafeIllegalStateException(com.palantir.logsafe.exceptions.SafeIllegalStateException) ConjureDefinition(com.palantir.conjure.spec.ConjureDefinition) ServiceDefinitionValidator(com.palantir.conjure.defs.validator.ServiceDefinitionValidator) ServiceDefinition(com.palantir.conjure.spec.ServiceDefinition) EnumValueDefinitionValidator(com.palantir.conjure.defs.validator.EnumValueDefinitionValidator) ConjureDefinitionValidator(com.palantir.conjure.defs.validator.ConjureDefinitionValidator) NamedTypesDefinition(com.palantir.conjure.parser.types.NamedTypesDefinition) Map(java.util.Map) ObjectDefinitionValidator(com.palantir.conjure.defs.validator.ObjectDefinitionValidator) ArgumentName(com.palantir.conjure.spec.ArgumentName) AnnotatedConjureSourceFile(com.palantir.conjure.parser.AnnotatedConjureSourceFile) ParameterId(com.palantir.conjure.spec.ParameterId) EndpointDefinitionValidator(com.palantir.conjure.defs.validator.EndpointDefinitionValidator) LogSafetyDefinition(com.palantir.conjure.parser.LogSafetyDefinition) ObjectDefinition(com.palantir.conjure.spec.ObjectDefinition) ConjureImports(com.palantir.conjure.parser.types.reference.ConjureImports) AuthType(com.palantir.conjure.spec.AuthType) Collection(java.util.Collection) SafeIllegalArgumentException(com.palantir.logsafe.exceptions.SafeIllegalArgumentException) Set(java.util.Set) BodyParameterType(com.palantir.conjure.spec.BodyParameterType) FieldDefinition(com.palantir.conjure.spec.FieldDefinition) Collectors(java.util.stream.Collectors) FieldDefinitionValidator(com.palantir.conjure.defs.validator.FieldDefinitionValidator) ParameterType(com.palantir.conjure.spec.ParameterType) List(java.util.List) AliasDefinition(com.palantir.conjure.spec.AliasDefinition) UnsafeArg(com.palantir.logsafe.UnsafeArg) ReferenceTypeResolver(com.palantir.conjure.defs.ConjureTypeParserVisitor.ReferenceTypeResolver) Documentation(com.palantir.conjure.spec.Documentation) ConjureRuntimeException(com.palantir.conjure.exceptions.ConjureRuntimeException) Optional(java.util.Optional) HttpPathValidator(com.palantir.conjure.defs.validator.HttpPathValidator) PrimitiveType(com.palantir.conjure.spec.PrimitiveType) EndpointDefinition(com.palantir.conjure.spec.EndpointDefinition) HttpMethod(com.palantir.conjure.spec.HttpMethod) LogSafety(com.palantir.conjure.spec.LogSafety) EnumDefinitionValidator(com.palantir.conjure.defs.validator.EnumDefinitionValidator) FieldNameValidator(com.palantir.conjure.defs.validator.FieldNameValidator) ErrorDefinition(com.palantir.conjure.spec.ErrorDefinition) Type(com.palantir.conjure.spec.Type) PathParameterType(com.palantir.conjure.spec.PathParameterType) TypeDefinitionVisitor(com.palantir.conjure.visitor.TypeDefinitionVisitor) HashMap(java.util.HashMap) Namespace(com.palantir.conjure.parser.types.names.Namespace) HttpPath(com.palantir.conjure.spec.HttpPath) ConjureIllegalArgumentException(com.palantir.conjure.exceptions.ConjureIllegalArgumentException) Function(java.util.function.Function) ArrayList(java.util.ArrayList) UnionDefinition(com.palantir.conjure.spec.UnionDefinition) HashSet(java.util.HashSet) ImmutableList(com.google.common.collect.ImmutableList) ErrorNamespace(com.palantir.conjure.spec.ErrorNamespace) TypeNameValidator(com.palantir.conjure.defs.validator.TypeNameValidator) PackageValidator(com.palantir.conjure.defs.validator.PackageValidator) TypeDefinition(com.palantir.conjure.spec.TypeDefinition) EnumDefinition(com.palantir.conjure.spec.EnumDefinition) CookieAuthType(com.palantir.conjure.spec.CookieAuthType) EnumValueDefinition(com.palantir.conjure.spec.EnumValueDefinition) ErrorDefinitionValidator(com.palantir.conjure.defs.validator.ErrorDefinitionValidator) ParameterName(com.palantir.conjure.parser.services.ParameterName) EndpointName(com.palantir.conjure.spec.EndpointName) QueryParameterType(com.palantir.conjure.spec.QueryParameterType) TypeName(com.palantir.conjure.spec.TypeName) FieldName(com.palantir.conjure.spec.FieldName) ConjureSourceFile(com.palantir.conjure.parser.ConjureSourceFile) DealiasingTypeVisitor(com.palantir.conjure.visitor.DealiasingTypeVisitor) ConjurePackage(com.palantir.conjure.parser.types.names.ConjurePackage) UnionDefinitionValidator(com.palantir.conjure.defs.validator.UnionDefinitionValidator) HeaderParameterType(com.palantir.conjure.spec.HeaderParameterType) Preconditions(com.palantir.logsafe.Preconditions) ArgumentDefinition(com.palantir.conjure.spec.ArgumentDefinition) HttpPath(com.palantir.conjure.spec.HttpPath) Documentation(com.palantir.conjure.spec.Documentation) EndpointDefinition(com.palantir.conjure.spec.EndpointDefinition)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ReferenceTypeResolver (com.palantir.conjure.defs.ConjureTypeParserVisitor.ReferenceTypeResolver)1 ConjureDefinitionValidator (com.palantir.conjure.defs.validator.ConjureDefinitionValidator)1 EndpointDefinitionValidator (com.palantir.conjure.defs.validator.EndpointDefinitionValidator)1 EnumDefinitionValidator (com.palantir.conjure.defs.validator.EnumDefinitionValidator)1 EnumValueDefinitionValidator (com.palantir.conjure.defs.validator.EnumValueDefinitionValidator)1 ErrorDefinitionValidator (com.palantir.conjure.defs.validator.ErrorDefinitionValidator)1 FieldDefinitionValidator (com.palantir.conjure.defs.validator.FieldDefinitionValidator)1 FieldNameValidator (com.palantir.conjure.defs.validator.FieldNameValidator)1 HttpPathValidator (com.palantir.conjure.defs.validator.HttpPathValidator)1 ObjectDefinitionValidator (com.palantir.conjure.defs.validator.ObjectDefinitionValidator)1 PackageValidator (com.palantir.conjure.defs.validator.PackageValidator)1 ServiceDefinitionValidator (com.palantir.conjure.defs.validator.ServiceDefinitionValidator)1 TypeNameValidator (com.palantir.conjure.defs.validator.TypeNameValidator)1 UnionDefinitionValidator (com.palantir.conjure.defs.validator.UnionDefinitionValidator)1 ConjureIllegalArgumentException (com.palantir.conjure.exceptions.ConjureIllegalArgumentException)1 ConjureRuntimeException (com.palantir.conjure.exceptions.ConjureRuntimeException)1 AnnotatedConjureSourceFile (com.palantir.conjure.parser.AnnotatedConjureSourceFile)1 ConjureSourceFile (com.palantir.conjure.parser.ConjureSourceFile)1 LogSafetyDefinition (com.palantir.conjure.parser.LogSafetyDefinition)1