Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Moving towards stronger schemas for response types #13529

Open
erikjohnston opened this issue Aug 15, 2022 · 3 comments
Open

Moving towards stronger schemas for response types #13529

erikjohnston opened this issue Aug 15, 2022 · 3 comments
Labels
A-Spec-Compliance places where synapse does not conform to the spec T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Cleanup Things we want to get rid of, but aren't actively causing pain

Comments

@erikjohnston
Copy link
Member

We've recently had a number of issues with Synapse returning unspecced fields in API response that clients have ended up relying on.

There are two related questions here:

  1. How do we ensure that our API responses match the spec?
  2. Can we automatically detect in CI when we change an API response, so that we can flag that extra care must be taken?

Long term there is a desire to move to generating responses via swagger from the Spec.

@DMRobertson
Copy link
Contributor

IIRC the swagger API has additionalProperties: true everywhere, either implicitly or explicitly. I think we'd have to change that if we wanted this enforcement to be automatic?

@richvdh
Copy link
Member

richvdh commented Aug 15, 2022

I don't think it sets additionalProperties: true for most responses?

@DMRobertson
Copy link
Contributor

additionalProperties: true is the default. To quote https://swagger.io/specification/#schema-object:

additionalProperties - Value can be boolean or object. Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. Consistent with JSON Schema, additionalProperties defaults to true.

See also the discussion on matrix-org/matrix-spec#1162 (review)

@H-Shay H-Shay added T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. labels Aug 15, 2022
@MadLittleMods MadLittleMods added A-Spec-Compliance places where synapse does not conform to the spec Z-Dev-Wishlist Makes developers' lives better, but doesn't have direct user impact Z-Cleanup Things we want to get rid of, but aren't actively causing pain and removed Z-Dev-Wishlist Makes developers' lives better, but doesn't have direct user impact labels Apr 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Spec-Compliance places where synapse does not conform to the spec T-Enhancement New features, changes in functionality, improvements in performance, or user-facing enhancements. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Cleanup Things we want to get rid of, but aren't actively causing pain
Projects
None yet
Development

No branches or pull requests

5 participants