Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parse ability #12

Open
4 tasks
matthew-inamdar opened this issue May 18, 2019 · 4 comments
Open
4 tasks

Add parse ability #12

matthew-inamdar opened this issue May 18, 2019 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@matthew-inamdar
Copy link
Member

matthew-inamdar commented May 18, 2019

Need to provide a way to take a PHP array, or JSON string and convert it into an OpenApi instance (with child objects created).

Should also be able to create any object from JSON, e.g. add a Schema from a JSON string (no need to parse an entire spec).

Todo

  • Provide abstract parse() method on BaseObject class - silently ignores any errors (missing/extra properties)
  • Provide abstract strictParse() method on BaseObject class - throws exception for any errors
  • Each object to define their own parse()/strictParse() implementation
  • Each implementation to handle the creation of child/nested objects
@baohx2000
Copy link

Wish I had the time to work on this. A related thing I would really like would be the ability to take a json schema for a property from an external source and inject it (with any required modifications).

@matthew-inamdar
Copy link
Member Author

matthew-inamdar commented Oct 28, 2020

Hey @baohx2000 👋

I don't fully understand - what's the use case for your suggestion? 🙂

@baohx2000
Copy link

I generate api documentation using this library by iterating through annotations in code. The annotations also define input parameter validation using various rules, one of which is using a json schema for complex values. What I'd like to do is include the schema as part of the openapi doc that gets generated from this library. Just figured parsing json into the library would be a good first step.

@matthew-inamdar
Copy link
Member Author

@baohx2000 So is the idea to parse JSON not only for the entire spec, but to append to an existing one? Sounds like a great idea. I'll update the issue to include.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Development

No branches or pull requests

2 participants