GithubHelp home page GithubHelp logo

Comments (4)

wol-soft avatar wol-soft commented on July 26, 2024

Hi, thanks for the report. I've figured out the issue with the RequestedPackageLineItemDimensions which is related to nested usage of allOf compositions which work with a patch I've developed (still need to write some test cases).

Another issue which occurs later is related to the Body entry of the schema, a large collection of oneOf references where only a single oneOf branch provides an actual schema. All other branches provide example data (so strictly no validation rules and every body is valid as a oneOf branch with only example data is always fulfilled no matter which data is provided). I'll have a deeper look into it and check if it makes sense to skip branches which only contain example data during the generation process.

For example:

{
  "body": 34
}

validates against the following simplified schema which shows the issue with the Body from the rate.json schema which doesn't seem to be intended:

{
  "type":"object",
  "properties":{
  	"body": {
    	"oneOf": [
          {
            "type":"object",
            "properties": {
              "name": {
              	"type": "string"
              }
            },
            "required": ["name"]
          },
          {
            "example": {
              "name": "wol-soft"
            }
          }
        ]
    }
  },
  "required": ["body"]
}

from php-json-schema-model-generator.

mehgcap avatar mehgcap commented on July 26, 2024

Thank you for checking into this! It would be great if your library could support these schemas. Everything I've tried so far has either choked on them, or generated output we've had to manually modify afterward. I think the body section you mentioned was a problem, and was one thing we had to remove from classes generated with another tool.

from php-json-schema-model-generator.

Kindlewing avatar Kindlewing commented on July 26, 2024

I pulled issue72_nestedCompositionbranch that links to this issue, and used it to generate ship models from FedEx's ship schema and got this error:

Message: Unresolved Reference #/components/schemas/RequestedShipment in file /tmp/ship.json    in file: /home/hfinn/repos/ship/vendor/wol-soft/php-json-schema-model-generator/src/PropertyProcessor/Property/ReferenceProcessor.php  
 on line: 50
    

Same as the rate schema, go to Shipping documentation > click Download Json Schema to look at the json.

from php-json-schema-model-generator.

wol-soft avatar wol-soft commented on July 26, 2024

Hi, I'm still facing some issues with the rate.json related to validators in combination with the nested allOf usage.

It takes some time to further investigate the issue which I'm currently not able to invest - sorry. I'll check it, when time allows.
To be fair: this seems to be the most complex schema I've seen the library being used on. Nice challenge 😄

Then I'll also have a look at the shipping schema. The schema looks correct, the reference is defined and consequently should be resolved.

from php-json-schema-model-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.