Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Translating JSON "OneOf" to RAML DataTypes #51

Open
HugaertsDries opened this issue Nov 5, 2019 · 2 comments
Open

Translating JSON "OneOf" to RAML DataTypes #51

HugaertsDries opened this issue Nov 5, 2019 · 2 comments
Labels
amf Related to AMF issue, bug or specific behavior bug Something isn't working

Comments

@HugaertsDries
Copy link

I'm trying to translate the following JSON schema to a RAML datatype using the provided tutorial. But it seems to fail parsing on the JSON "OneOf" keyword. Is this not yet supported?

Input JSON:

{
 "$schema" : "http://json-schema.org/draft-04/schema#",
 "title" : "Product",
 "type" : "object",
 "oneOf" : [ {
    "$ref" : "#/definitions/PromotionalProduct_-1109912719"
 }, {
    "$ref" : "#/definitions/DefaultProduct_-1835798300"
 } ],
 "id" : "#/definitions/Product_-1110706969"
}

output RAML:

  Product_-1110706969:
    displayName: Product
    type: object
    (amf-xone):
      - PromotionalProduct_-1109912719
      - DefaultProduct_-1835798300
@postatum
Copy link
Contributor

postatum commented Nov 6, 2019

Hi @HugaertsDries.
What do you expect anyOf to be converted to?

I'm not certain it's possible to represent anyOf using RAML 1.0, because

given data must be valid against exactly one of the given subschemas

and I can't recall a way to express that behaviour in RAML (do you @jstoiko?)

You might want to use oneOf which is a Union Type in RAML 1.0, but there's an issue with it: aml-org/amf#565

@HugaertsDries
Copy link
Author

@postatum thanks for the reply!

I was only looking into representing oneOf. So I have not yet looked into the use case of anyOf.
But I'll keep a close eye on the issue you provided.

@postatum postatum added the amf Related to AMF issue, bug or specific behavior label Jan 31, 2020
@postatum postatum added the bug Something isn't working label Jun 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
amf Related to AMF issue, bug or specific behavior bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants