Code Monkey home page Code Monkey logo

Comments (9)

fenollp avatar fenollp commented on May 28, 2024 1

Could these help?

I'd love a solution to this issue too!

Also, since AsyncAPI isn't OpenAPI why not just use a subset of JSON Schema Draft XY? OpenAPI schemas are not exactly a subset + history has shown people get confused between the two + there are way more JSON Schema validators/tools than there are for OpenAPI Schemas...

I can't wait for both these standards to support "here's my schema in language XYZ" :)

from generator.

fmvilas avatar fmvilas commented on May 28, 2024 1

We removed support for multiple formats on a single message for simplicity of the spec because that's not the case of many people. Overlays will allow you to do that. In any case, if the message is not exactly the same, they should be different messages.

from generator.

fmvilas avatar fmvilas commented on May 28, 2024 1

This was fixed by #204. Closing.

from generator.

fenollp avatar fenollp commented on May 28, 2024

Maybe the JSON schema version of "nullable": true works?
"type": ["null", ...]

from generator.

ymarillet avatar ymarillet commented on May 28, 2024

The editor does not complain with type: ["null", string]

But it shouldn't work as per the specification:

The following properties are taken from the JSON Schema definition but their definitions were adjusted to the AsyncAPI Specification.

type - Value MUST be a string. Multiple types via an array are not supported.

from generator.

fmvilas avatar fmvilas commented on May 28, 2024

Hi @ymarillet! Sorry for the late response. I'm currently on holidays and can't help so much but there are two issues here:

  • As you correctly point out, it should be supporting nullable and should be complaining about [null, string].
  • The reason you don't see it working is because the documentation generator is parsing the schemas as if they were jsonschema schemas instead of asyncapi schemas. And on top of that, I didn't take into account the possibility of having a nullable property.

Would you mind creating a PR on https://github.com/asyncapi/docgen?

from generator.

ymarillet avatar ymarillet commented on May 28, 2024

Hello there

I don't have much time to work on this unfortunately :(, but will try to as soon as I get some spare time..

In the meantime, please do not consider I'm working on it activly.

I really like the project though, hope it'll get even better !

from generator.

fmvilas avatar fmvilas commented on May 28, 2024

@fenollp I'm glad you ask for multiple schema support. It's already implemented in the spec for version 2.0.0, which should be ready by May this year. Check it out:

from generator.

fenollp avatar fenollp commented on May 28, 2024

@fmvilas Nice! May isn’t far off too :)
We’re going to need to be able to specify schemas in more than one formats though at some point. It appears you’d prefer to allow as of yet unspec-ed Overlays instead of allowing multiple schema formats for the same payload. Why not. I guess there are issues I’m not seeing with the latter.
Anyway we may rely on something that translates for example our protobuf to JSON schema but these two have semantics that the other misses so I’m not sure about that yet.

from generator.

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.