openapi-fuzzer
openapi-fuzzer copied to clipboard
Panic with error "not implemented: No support to dereference ......"
OpenAPI specification file: https://github.com/diem/diem/blob/main/api/doc/openapi.yaml
Error:
thread 'main' panicked at 'not implemented: No support to dereference #/components/schemas/MoveAbility.', /Users/ilx/.cargo/registry/src/github.com-1ecc6299db9ec823/openapi_utils-0.2.1/src/reference.rs:69:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Looked into the dereferenced schema, looks like some references inside array#items are not dereferenced.
Thanks for the report. I looks like a bug in a depending crate, I'll look into it. If you had some minimal example where it fails, it'd be great.
I'm also experiencing this! We have the following markup
# openapi.yml
paths:
/api/v1/health:
$ref: 'components/internal.yml#/endpoints/getHealth'
This references a the file components/internal.yml
relative to openapi.yml
file location. It has the following contents
endpoints:
getHealth:
get:
description: Gets health check.
operationId: getHealth
[....]
which will give
thread 'main' panicked at 'not implemented: No support to dereference components/internal.yml#/endpoints/getHealth.'
Is this enough info for you @matusf?
Hi @xvilo, thanks, that's a great report. You essentially identified the issue. openapi_utils
is unable to dereference the $ref
in components section since it is located in other file. The issue is that there is no support for loading external files in openapiv3
or openapi_utils
libraries, which openapi-fuzzer
relies on when parsing the specification.
This also means that your and @xli's issues are different, since the diem OpenAPI specification does not uses. Remote references.
Until it is not implemented, you can try something like this to combine the specifications.
We where already using speccy to combine it into json format. However, when it's combined into a single yaml file I'm still getting these warnings
thread 'main' panicked at 'No Reference found!: ReferenceError { name: "default" }', /Users/xvilo/.cargo/registry/src/github.com-1ecc6299db9ec823/openapi_utils-0.2.2/src/dereferer.rs:161:63
Unfortunately there isn't an easy way to get the right line where this occurs
I'm sorry that it did not work out @xvilo. Could you please share the specification? When I'll have some spare time I'll try to debug, minimize and report it to the underlying crates.
I'm sorry that it did not work out @xvilo. Could you please share the specification? When I'll have some spare time I'll try to debug, minimize and report it to the underlying crates.
@matusf Same problem here. Attaching the file that is causing the problem (I also used speccy to do the remote ref resolutions)
openapi: 3.0.3
info:
title: Hyperledger Cactus Plugin - Consortium Web Service
description: Manage a Cactus consortium through the APIs. Needs administrative privileges.
version: 0.0.1
license:
name: Apache 2.0
url: https://www.apache.org/licenses/LICENSE-2.0.html
components:
schemas:
GetNodeJwsResponse:
type: object
required:
- jws
properties:
jws:
type: object
required:
- payload
- signatures
properties:
payload:
type: string
minLength: 1
maxLength: 65535
signatures:
type: array
items:
description: "A JSON Web Signature. See: https://tools.ietf.org/html/rfc7515 for
info about standard."
type: object
required:
- signature
properties:
signature:
type: string
protected:
type: string
header:
type: object
additionalProperties: true
GetConsortiumJwsResponse:
type: object
required:
- jws
properties:
jws:
$ref: "#/components/schemas/GetNodeJwsResponse/properties/jws"
PrometheusExporterMetricsResponse:
type: string
nullable: false
GetNodeJwsRequest:
type: object
additionalProperties: false
properties: {}
GetConsortiumJwsRequest:
type: object
additionalProperties: false
properties: {}
paths:
/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/consortium/jws:
post:
x-hyperledger-cactus:
http:
verbLowerCase: post
path: /api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/consortium/jws
operationId: getConsortiumJwsV1
summary: Retrieves a consortium JWS
description: The JWS asserting the consortium metadata (pub keys and hosts of nodes)
parameters: []
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/GetConsortiumJwsRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/GetConsortiumJwsResponse"
/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/node/jws:
post:
x-hyperledger-cactus:
http:
verbLowerCase: post
path: /api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/node/jws
operationId: getNodeJwsV1
summary: Retrieves the JWT of a Cactus Node
parameters: []
requestBody:
content:
application/json:
schema:
$ref: "#/components/schemas/GetNodeJwsRequest"
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/GetNodeJwsResponse"
/api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/get-prometheus-exporter-metrics:
get:
x-hyperledger-cactus:
http:
verbLowerCase: get
path: /api/v1/plugins/@hyperledger/cactus-plugin-consortium-manual/get-prometheus-exporter-metrics
operationId: getPrometheusMetricsV1
summary: Get the Prometheus Metrics
parameters: []
responses:
"200":
description: OK
content:
text/plain:
schema:
$ref: "#/components/schemas/PrometheusExporterMetricsResponse"
Same issue here