Code Monkey home page Code Monkey logo

Comments (7)

RobinTail avatar RobinTail commented on June 10, 2024 1

@pjmolina , it seems that the changes made by #124 are wrong, because the property examples exists in multiple interfaces. In most cases it's really the ExampleObject, but within the SchemaObject examples still has to be an array.
I'm suggesting to revert #124 .

from openapi3-ts.

kkolstad avatar kkolstad commented on June 10, 2024 1

@RobinTail I see my mistake now. Thanks for pointing that out. Sorry for the bug 😄

from openapi3-ts.

pjmolina avatar pjmolina commented on June 10, 2024 1

Thansk for the analysis @RobinTail

from openapi3-ts.

kkolstad avatar kkolstad commented on June 10, 2024

I based those changes off the OpenAPI Specification 3.0 and 3.1

Screenshot 2023-12-21 at 2 31 57 PM

from openapi3-ts.

RobinTail avatar RobinTail commented on June 10, 2024

The examples you refer to, are NOT the property of SchemaObject.
This is the examples property of ComponentsObject, @kkolstad

image

image

Anyway, thank you very much for responding.

from openapi3-ts.

vafanassieff avatar vafanassieff commented on June 10, 2024

Hey @kkolstad when I read the Open API spec 3.1, i see that ParameterObject has a examples field that can be set to Map[ string, Example Object | Reference Object]

How do i use this type to add examples to my Open Api spec ?

Best

from openapi3-ts.

RobinTail avatar RobinTail commented on June 10, 2024

Regarding the particular examples in ParameterObject you refer to, @vafanassieff:

What they call Map is a Record in Typescript.
So you assign examples with object having keys as string and values as ExampleObject | ReferenceObject

...
examples: {
  example1: {
    value: "something"
  }
}

See the definition of ExampleObject here:
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#example-object

It's typed correctly in the library and not related to this issue.

from openapi3-ts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.