swisnl / openapi-spec-generator

Creates Open API spec for a Laravel JSON:API
Apache License 2.0
23 stars 11 forks source link

Support non-Eloquent resource #17

Closed maartenpaauw closed 1 year ago

maartenpaauw commented 1 year ago

Description

Add initial support for non-Eloquent resources

Motivation and context

Laravel JSON:API offers support for non-Eloquent resources. This PR add initial support for non-Eloquent resources.

It isn't flawless because, the entity under the hood needs to implement ArrayAccess and have static all method (which is needed to generate examples). But it's a good start.

How has this been tested?

Tests are green and the JSON file is generating.

Screenshots (if appropriate)

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

Please, please, please, don't send your pull request until all of the boxes are ticked. Once your pull request is created, it will trigger a build on our continuous integration server to make sure your tests and code style pass.

If you're unsure about any of these, don't hesitate to ask. We're here to help!

Rocksheep commented 1 year ago

Hi @maartenpaauw ,

Thank you for the PR. The code looks good, but could you add tests to prove that the code works?

maartenpaauw commented 1 year ago

The project where we use this package has been postponed. As a result, I haven't had time to write tests yet.

Rocksheep commented 1 year ago

Ah alright. For now I've merged this into a separate branch and I'm expanding on it to include some tests. Thank you for your contribution 😄