Skip to content

fix(keys): fix delete schema response - #77

Open
tharropoulos wants to merge 2 commits into
typesense:masterfrom
tharropoulos:api-key-schema
Open

fix(keys): fix delete schema response#77
tharropoulos wants to merge 2 commits into
typesense:masterfrom
tharropoulos:api-key-schema

Conversation

@tharropoulos

Copy link
Copy Markdown
Contributor

Change Summary

Add a new interface for response schemas after deletion, as the API only returns the id of the API key instead of the whole object.

❯ curl -k "http://localhost:8108/keys/15" \
-X DELETE \
-H "Content-Type: application/json" \
-H "X-TYPESENSE-API-KEY: ${TYPESENSE-API-KEY}" \
{"id":15} // Nothing other than the id of the key

This is part of a larger problem regarding the OpenAPI spec, as according to it, the 200 response schema of a API Key DELETE request is defined as:

/keys/{keyId}:
delete:
tags:
- keyssummary: Delete an API key given its ID.operationId: deleteKeyparameters:
- name: keyIdin: pathdescription: The ID of the key to deleterequired: trueschema:
type: integerformat: int64responses:
200:
description: The key referenced by the IDcontent:
application/json:
schema:
$ref: "#/components/schemas/ApiKey"

Where the ApiKey schema is defined as:

ApiKeySchema:
type: objectrequired:
- actions
- collections
- descriptionproperties:
value:
type: stringdescription:
type: stringactions:
type: arrayitems:
type: stringcollections:
type: arrayitems:
type: stringexpires_at:
type: integerformat: int64ApiKey:
allOf:
- $ref: "#/components/schemas/ApiKeySchema"
- type: objectproperties:
id:
type: integerformat: int64readOnly: truevalue_prefix:
type: stringreadOnly: true

PR Checklist

- Add a new interface for response schemas after deletion, as the api
only returns the id of the api key instead of the whole object
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@tharropoulos