unhelpful open API warning

Answered

Yesterday, while attempting to commit changes to an api.yaml file, IntelliJ warned me about problems with $ref references.

    Warning:(143, 11) Schema validation: Property '$ref' is not allowed
    Warning:(144, 11) Schema validation: Property 'example' is not allowed

I consulted the swagger editor, which I trust more in this context, and it found no problems. (The api.yaml gets correctly digested by both the openapi code generator and other processes that need to parse it.)

Questions:
1) Is there perhaps some kind of configuration I need to update?

2) Can I disable categories of warnings when, as in this case, they are unhelpful?

- - -

I'm using

IntelliJ IDEA 2022.2 (Ultimate Edition)
Build #IU-222.3345.118, built on July 26, 2022
Licensed to ...

Runtime version: 17.0.3+7-b469.32 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
- - -

Your API insists I choose a topic. The one I chose has "Open API" in it, though I am not doing Plugin Development and don't really know what this topic refers to.

2 comments
Comment actions Permalink

Hi Tim T Hanson Can you please provide yaml file example for the investigation? Thank you!

0
Comment actions Permalink

 

hi, Egor, sure. https://editor.swagger.io/ is perfectly happy with this api.yaml (a much scaled-down version of what we do):

openapi: 3.0.1
servers:
- url: 'http://localhost:8080'
description: local / lokal
info:
title: some API
description: An API that uses a reference.
version: "0.1"

paths:
/foo/v1/bar:
get:
summary: returns json
operationId: getSomething
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/FooResponse"

components:
schemas:
FooResponse:
type: object
properties:
Foo:
$ref: '#/components/schemas/BarResource'
example: "{
'myId': '123'
}"
BarResource:
type: object
properties:
myId:
type: integer

but my IntelliJ warns when I try to commit it:

Warning:(29, 11) Schema validation: Property '$ref' is not allowed
Warning:(30, 11) Schema validation: Property 'example' is not allowed

0

Please sign in to leave a comment.