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

Projects
None yet
3 participants
@turt2live
Copy link
Member

commented Jun 6, 2019

Fixes #1907

@turt2live turt2live added the Matrix 1.0 label Jun 6, 2019

@turt2live turt2live requested a review from matrix-org/spec-core-team Jun 6, 2019

@turt2live turt2live force-pushed the travis/1.0/key-object branch from c6d742b to a19eb59 Jun 6, 2019

@turt2live

This comment has been minimized.

Copy link
Member Author

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 #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

This comment has been minimized.

Copy link
Member

commented Jun 10, 2019

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

@turt2live

This comment has been minimized.

Copy link
Member Author

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

This comment has been minimized.

Copy link
Member

commented Jun 11, 2019

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

@uhoreg

uhoreg approved these changes Jun 11, 2019

Copy link
Member

left a comment

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.

turt2live added some commits Jun 11, 2019

Fix invalid doc error
Another annoying case of Swagger fighting us
@uhoreg

uhoreg approved these changes Jun 11, 2019

Copy link
Member

left a comment

made a suggestion, but lgtm otherwise

Show resolved Hide resolved api/client-server/keys.yaml

@turt2live turt2live merged commit 8ac555f into master Jun 11, 2019

8 checks passed

buildkite/matrix-doc Build #321 passed (56 seconds)
Details
ci/circleci: build-dev-scripts Your tests passed on CircleCI!
Details
ci/circleci: build-docs Your tests passed on CircleCI!
Details
ci/circleci: build-swagger Your tests passed on CircleCI!
Details
ci/circleci: check-docs Your tests passed on CircleCI!
Details
ci/circleci: validate-docs Your tests passed on CircleCI!
Details
docs Click details to preview the HTML documentation.
Details
swagger Click to preview the swagger build.
Details

@turt2live turt2live deleted the travis/1.0/key-object branch Jun 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.