A small valid contract
Du skriver inn
- Format
- YAML
- Dokument
- openapi: 3.1.0
info:
title: Sample API
version: 1.0.0
paths:
/items/{itemId}:
get:
operationId: getItem
summary: Read one item
parameters:
- name: itemId
in: path
required: true
schema:
type: string
responses:
"200":
description: Item returned
Du får
- Funn
- 0
- Operasjoner
- GET /items/{itemId} — Les ett element · 200
This is the example the page loads. It has a version, a title, a path, an operation id, a declared path parameter and a described response, so the checks find nothing to report.
Kjørt med verktøyets egen kode.
A missing operation id and path parameter
Du skriver inn
- Dokument
- The same contract, with the operationId line and the parameters block deleted
Du får
- Funn
- Add an operationId. (GET /items/{itemId}); Declare this path parameter with in: path. (GET /items/{itemId} · itemId)
The path has {itemId} in it, so a required parameter with in: path must be declared for it. Without the operationId line, the operation also has no id.
Kjørt med verktøyets egen kode.
A duplicate id and a broken local reference
Du skriver inn
- Dokument
- Two operations that both use operationId x, and a response that points to #/components/responses/Nope
Du får
- Funn
- operationId must be unique. (x); This local reference does not resolve. (#/components/responses/Nope)
Operation ids must be different across the whole contract. The reference starts with # so it is looked up inside the document, and nothing exists at that location.
Kjørt med verktøyets egen kode.
A remote reference is refused, not fetched
Du skriver inn
- Dokument
- A response with $ref: https://example.com/r.json
Du får
- Funn
- Only local JSON Pointer references are allowed; this reference was not fetched.
Only references that begin with # are followed. A web address is reported as a finding and the tool makes no request to it.
Kjørt med verktøyets egen kode.