Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(api-spec): update session endpoint specs #110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bjoern-m
Copy link
Contributor

Description

This PR updates the OpenAPI specification for the session endpoints to align the response definitions to the API changes made in teamhanko/hanko#2003 .

Changes Made

  1. Endpoint Response Updates:

    • Added 500 responses (InternalServerError) to the GET /sessions/validate and POST /sessions/validate endpoints for better documentation of potential server errors.
    • Enhanced the 400 responses (BadRequest) for these endpoints.
  2. Schema Enhancements:

    • Introduced a new schema, JWTClaims, to describe the claims extracted from JWTs.
    • Includes fields are: subject, issued_at, expiration, audience, issuer, email, and session_id.
    • Deprecated the following fields in the ValidateSessionResponse schema:
      • expires_at
      • user_id

Notes

  • Consumers of the API are encouraged to transition to the new JWTClaims schema as the deprecated fields will be removed in a future release.

@bjoern-m bjoern-m marked this pull request as ready for review December 30, 2024 11:28
format: date-time
audience:
description: "The intended audience of the token."
type: string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently an array of strings, so:

Suggested change
type: string
type: array
items:
type: string

Comment on lines +1544 to +1546
description: "The email address associated with the token's subject, if available."
type: string
format: email
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently an object with address, is_primary, is_verified so maybe something like (hope formatting works out):

Suggested change
description: "The email address associated with the token's subject, if available."
type: string
format: email
description: "Data about the email address associated with the token's subject, if available."
type: object
properties:
address:
description: "The actual email address."
type: string
format: email
is_primary:
description: "Indicates whether the email address is the primary address."
type: boolean
is_verified:
description: "Indicates whether the email address is verified."
type: boolean

@@ -1049,10 +1055,14 @@ components:
description: Date-time indicating the expiration of the session
type: string
format: date-time
deprecated: true
Copy link
Member

@lfleischmann lfleischmann Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mintlify now actually shows deprecated badges for some schema properties (not on schemas for endpoint operations though 🙄 ). This is good but I feel this is still not enough info:

Should we also mention in the description which other properties this one has been deprecated in favor of (in this case it would be claims.expiration, I guess)? Otherwise I wouldn't know what property I need to use.

user_id:
description: The ID of the user the session is associated with
type: string
format: uuid4
deprecated: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

Sign up for free to 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.

2 participants