From 88e1152a75bf1d4edd555c197ab0c27e756d574e Mon Sep 17 00:00:00 2001 From: Pratik Joseph Dabre Date: Thu, 31 Oct 2024 20:09:41 -0500 Subject: [PATCH] Add OpenAPI documentation for /v1/functions --- .../main/resources/function_signatures.yaml | 20 +++++++ .../src/main/resources/schemas.yaml | 54 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 presto-openapi/src/main/resources/function_signatures.yaml diff --git a/presto-openapi/src/main/resources/function_signatures.yaml b/presto-openapi/src/main/resources/function_signatures.yaml new file mode 100644 index 0000000000000..7871a2960b4a8 --- /dev/null +++ b/presto-openapi/src/main/resources/function_signatures.yaml @@ -0,0 +1,20 @@ +openapi: 3.0.0 +info: + title: Presto function signatures API + description: API for retrieving function signatures in Presto. + version: "1" +servers: + - url: http://localhost:8080 + description: Presto endpoint when running locally +paths: + /v1/functions: + get: + summary: Returns the list of function signatures. + description: This endpoint retrieves the supported function signatures from a Prestissimo cluster. + responses: + '200': + description: List of function signatures. + content: + application/json: + schema: + $ref: './schemas.yaml/#/components/schemas/JsonBasedUdfFunctionMetadata' diff --git a/presto-openapi/src/main/resources/schemas.yaml b/presto-openapi/src/main/resources/schemas.yaml index b9f3c312bc4fc..bcb5aaca438c9 100644 --- a/presto-openapi/src/main/resources/schemas.yaml +++ b/presto-openapi/src/main/resources/schemas.yaml @@ -1018,6 +1018,60 @@ components: type: string hidden: type: boolean + AggregationFunctionMetadata: + type: object + required: + - intermediateType + - isOrderSensitive + properties: + intermediateType: + $ref: '#/components/schemas/TypeSignature' + description: Intermediate TypeSignature for the aggregation function + isOrderSensitive: + type: boolean + description: Determines if the corresponding aggregation function is order-sensitive + JsonBasedUdfFunctionMetadata: + type: object + required: + - docString + - functionKind + - outputType + - paramTypes + - schema + - routineCharacteristics + - variableArity + properties: + docString: + type: string + description: Description of the function + functionKind: + $ref: '#/components/schemas/FunctionKind' + description: FunctionKind of the function + outputType: + $ref: '#/components/schemas/TypeSignature' + description: Output type of the function + paramTypes: + type: array + items: + $ref: '#/components/schemas/TypeSignature' + description: Input types of the function + schema: + type: string + description: Schema the function belongs to. Catalog.schema.function uniquely identifies a function. + routineCharacteristics: + $ref: '#/components/schemas/RoutineCharacteristics' + description: Implement language of the function. + variableArity: + type: boolean + description: Arity of the function. + typeVariableConstraints: + type: array + items: + $ref: '#/components/schemas/TypeVariableConstraint' + description: Optional list of the typeVariableConstraints. + aggregationFunctionMetadata: + $ref: '#/components/schemas/AggregationFunctionMetadata' + description: Optional Aggregate-specific metadata (required for aggregation functions)