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

Clarify the key object definition for the key management API #2083

Merged
merged 4 commits into from
Jun 11, 2019

Conversation

turt2live
Copy link
Member

Fixes #1907

@turt2live turt2live added the Matrix 1.0 Spec PRs that need review for 1.0 label Jun 6, 2019
@turt2live turt2live requested a review from a team June 6, 2019 03:06
@turt2live turt2live force-pushed the travis/1.0/key-object branch from c6d742b to a19eb59 Compare June 6, 2019 04:09
@turt2live
Copy link
Member Author

turt2live commented Jun 6, 2019

It's very annoying that Swagger doesn't support the thing we want to do (anyOf on a response schema). It supports it just fine for request parameters, but not in the response schema for some reason.

Error is the cryptic:

JSON_OBJECT_VALIDATION_FAILED",
  "stack": "SyntaxError: Swagger schema validation failed.
  Data does not match any schemas from 'oneOf' at #/paths//keys/claim/post/responses/200
    Data does not match any schemas from 'oneOf' at #/paths//keys/claim/post/responses/200/schema
      Data does not match any schemas from 'anyOf' at #/schema/properties/one_time_keys/additionalProperties
        Data does not match any schemas from 'anyOf' at #/properties/one_time_keys/additionalProperties/additionalProperties
          Data does not match any schemas from 'anyOf' at #/additionalProperties/type
            No enum match for: string,[object Object] at #/type
            No enum match for: {\"type\":\"object\",\"title\":\"KeyObject\",\"properties\":{\"key\":{\"type\":\"string\",\"description\":\"The key, encoded using unpadded base64.\"},\"signatures\":{\"type\":\"object\",\"description\":\"Signature for the device. Mapped from user ID to signature object.\",\"additionalProperties\":{\"type\":\"string\"}}},\"required\":[\"key\",\"signatures\"]} at #/type/1
          Expected type boolean but found type object at #/additionalProperties
        Expected type boolean but found type object at #/properties/one_time_keys/additionalProperties
      Additional properties not allowed: properties at #/schema
    Missing required property: $ref at #/paths//keys/claim/post/responses/200

Edit: our rendering engine can figure it out (which is why it is defined as such in the s2s spec), however we'll run into problems when https://github.com/matrix-org/matrix-doc/issues/2085 gets implemented. I'm inclined to just fork that problem off to that issue though rather than hide a swagger definition in both specs.

@ara4n
Copy link
Member

ara4n commented Jun 10, 2019

errrm... looks like swagger. maybe? possibly? </dog_goggles>

@turt2live
Copy link
Member Author

turt2live commented Jun 10, 2019

It's definitely swagger, although the diff (and swagger, annoyingly) is very confusing. It's supposed to be fix the nesting levels while also making documentation a thing.

@uhoreg
Copy link
Member

uhoreg commented Jun 11, 2019

Something isn't happy in CS /keys/upload:
image

Copy link
Member

@uhoreg uhoreg left a comment

Choose a reason for hiding this comment

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

The content looks good. The structure (other than the error message from the above comment) looks plausible, though I'm not a swagger expert. Should be fine to merge once the error is fixed.

Another annoying case of Swagger fighting us
Copy link
Member

@uhoreg uhoreg left a comment

Choose a reason for hiding this comment

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

made a suggestion, but lgtm otherwise

api/client-server/keys.yaml Show resolved Hide resolved
@turt2live turt2live merged commit 8ac555f into master Jun 11, 2019
@turt2live turt2live deleted the travis/1.0/key-object branch June 11, 2019 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Matrix 1.0 Spec PRs that need review for 1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Key object definition.
3 participants