Skip to content

Commit

Permalink
feat: update openapi spec with identity and is_anonymous fields (supa…
Browse files Browse the repository at this point in the history
…base#1573)

## What kind of change does this PR introduce?

Adds the `Identity` and `is_anonymous` fields to OpenAPI spec. This is
so we can use the `openapi.yml` as a sgeneral reference from which to
generate Hook Payloads, which contain `User` objects.

Identity Fields taken from the [identity
model](https://github.com/supabase/auth/blob/master/internal/api/identity.go)

## More Context

User objects are generated by:

1. Converting the `openapi.yml` into JSONSchema. Currently this is done
via OpenAI though a modified version of [a yml to jsonschema converter
should work with modifications as
well](https://www.npmjs.com/package/yaml-to-json-schema). We don't use
the latter as there's an additional step of converting the output
jsonschema into a format that JSON Faker can accept (adding the
JSONSchema version etc)
2. Using [JSONSchema to generate a fake
payload](https://json-schema-faker.js.org/)

## Use

The plan is to embed the JSONSchema into each Hook example so developers
can copy paste into JSONSchema Faker or similar tool to generate a fake
payload.
  • Loading branch information
J0 authored and LashaJini committed Nov 13, 2024
1 parent abb960c commit 59d7b01
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,7 @@ components:
identities:
type: array
items:
type: object
$ref: "#/components/schemas/IdentitySchema"
banned_until:
type: string
format: date-time
Expand All @@ -1853,6 +1853,8 @@ components:
deleted_at:
type: string
format: date-time
is_anonymous:
type: boolean

SAMLAttributeMappingSchema:
type: object
Expand Down Expand Up @@ -1958,6 +1960,35 @@ components:
Usually one of:
- totp
IdentitySchema:
type: object
properties:
identity_id:
type: string
format: uuid
id:
type: string
format: uuid
user_id:
type: string
format: uuid
identity_data:
type: object
provider:
type: string
last_sign_in_at:
type: string
format: date-time
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
email:
type: string
format: email

responses:
OAuthCallbackRedirectResponse:
description: >
Expand Down

0 comments on commit 59d7b01

Please sign in to comment.