playpauseandstop / rororo

Implement aiohttp.web OpenAPI 3 server applications with schema first approach.
https://rororo.readthedocs.io
BSD 3-Clause "New" or "Revised" License
106 stars 9 forks source link

rororo doesn't seem to work on vc-http-api.yml https://w3c-ccg.github.io/vc-http-api/ #159

Open daidoji opened 3 years ago

daidoji commented 3 years ago

There seem to be quite a few errors so I won't go into much detail. However, I noticed that if I take the schema above and the example json (copy pasted from /credentials/issue endpoint in that url) using the curl command I get the following error.

daidoji@worklaptop:~/TrustScience/vc-http-api/pcurl -i -H "Accept: application/json" -H "Content-Type: application/json" -X POST --data @bar.json http://localhost:8080/credentials/issue
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json; charset=utf-8
Content-Length: 109
Date: Tue, 02 Mar 2021 22:27:06 GMT
Server: Python/3.9 aiohttp/3.6.3

{"detail": [{"loc": ["body", "credential", "issuer"], "message": "'did:example:123' is not of type object"}]}

However, you'll see in the yaml that body/credential/issuer can be:

    Issuer:
      type: object
      description: A JSON-LD Verifiable Credential Issuer.
      oneOf:
        - type: string
        - type: object
          properties:
            id:
              type: string
      example:
        { "id": "did:key:z6MkjRagNiMu91DduvCvgEsqLZDVzrJzFrwahc4tXLt9DoHd" }

So I should be able to pass an json object of type object with a property of id or a string directly. This seems like a bug in rororo because if I remove the oneOf section and chance the type of the Issuer spec to string directly then the curl command works.

playpauseandstop commented 1 year ago

The repo has been moved to: https://github.com/w3c-ccg/vc-api/

The latest schema: vc-api-2023-05-28-22-47.zip

playpauseandstop commented 1 year ago

Been able to reproduce the error in #363, next will try to dig deeper and decide whether it is possible to properly support oneOf schema definitions with ancient openapi-core version that been used by rororo or is it needed to update to latest openapi-core.

Maybe related: #149

playpauseandstop commented 1 year ago

@daidoji

I am able to reproduce error and "cover" it with test case in #363, but cannot fix it with currently supported version of openapi-core>=0.13.4,<0.13.7. However, as latest openapi-core version is 0.17.1, I hope the error will gone after #149 will be implemented.

Hope next update on a topic will be available soon.