Coder Social home page Coder Social logo

Comments (24)

byjg avatar byjg commented on August 28, 2024 1

I am planning moving on this until the end of the month. But any help is appreciate. Another interesting point: if we see some fork with a cool feature anyone can suggest a PR and we'll analyse with care 👍

from php-swagger-test.

byjg avatar byjg commented on August 28, 2024 1

I sent a message since april to the PR owner and I didn't get any answer yet. So, I'll implement by myself then.

from php-swagger-test.

JohnRoux avatar JohnRoux commented on August 28, 2024 1

Ummm, it is a private project still, let me rather generate a fresh example doc for you with some of the specifics taken out.

from php-swagger-test.

JohnRoux avatar JohnRoux commented on August 28, 2024 1

Yeah please!

from php-swagger-test.

byjg avatar byjg commented on August 28, 2024 1

The implementation was complete, but still some fixes to do.

I have this PR: #67 to test. I would be glad if you could help me to test it.

from php-swagger-test.

ODAEL avatar ODAEL commented on August 28, 2024 1

@kachar Could you please provide more details or some examples? As I know, oneOf case should work properly, and your Not all cases are defined may be caused by other problems.

from php-swagger-test.

kachar avatar kachar commented on August 28, 2024 1

I'll try to setup a testcase, thanks for the update

from php-swagger-test.

iskrenvankov avatar iskrenvankov commented on August 28, 2024

Hi, I saw there's a (partial) fix for this in the plusForta/php-swagger-test fork.
Can we expect those changes to be merged back in the main project here?

Edit: that patch is a very naive implementation that doesn't actually work for nested references.
So I'm changing my original question to: Can we expect full support for the oneOf, anyOf, allOf, and not tags?

from php-swagger-test.

iskrenvankov avatar iskrenvankov commented on August 28, 2024

Sounds great! At this point I can't offer code assistance but once it's out on some dev branch I can test it against my codebase since I have already incorporated the library and I have particular test cases that fail now and should pass when it works.

from php-swagger-test.

JohnRoux avatar JohnRoux commented on August 28, 2024

Just encountered this issue today as well.
I applied the fix from that commit and it works 100% for my usecase if that helps.

I'm very in favour of getting that PR'd in otherwise I won't be able to use the assertRequest for any of my Schema's 😭

from php-swagger-test.

byjg avatar byjg commented on August 28, 2024

I merged his PR. I still have to add unit test before integrate to the main branch. If you can produce any swagger.json with these use cases I'd appreaciate and will make it faster.

Here the instructions to use the dev branch:
#57 (comment)

from php-swagger-test.

JohnRoux avatar JohnRoux commented on August 28, 2024

I'm actually using this via a laravel wrapper
Probably want to write my own wrapper though as had to pull a lot of stuff out of that one

https://dev.saythanks.app/api/documentation
https://dev.saythanks.app/docs/api-docs.json

I forked the wrapper and pushed through the 3.1.1.x-dev version. All my auth tests are working 🚀
(See the JWT Schema, it uses AllOf and then 4 props)

from php-swagger-test.

JohnRoux avatar JohnRoux commented on August 28, 2024

https://gist.github.com/JohnRoux/9a85c2b7a98d4e5bc1a3a6a45434f244

That's how I'm using it at the moment.
Want to pull a large chunk of the helper code out into a laravel package for it though

from php-swagger-test.

byjg avatar byjg commented on August 28, 2024

Awesome! This will help a lot.

from php-swagger-test.

JohnRoux avatar JohnRoux commented on August 28, 2024

For sure, scream if I can help at all 👍

from php-swagger-test.

byjg avatar byjg commented on August 28, 2024

Can I add your swagger implementation into the project?

from php-swagger-test.

JohnRoux avatar JohnRoux commented on August 28, 2024

I can't promise that this is great or even good 😅
But it's technically allowed by the spec and seems to work well for my usecase.

https://gist.github.com/JohnRoux/d2e3963e29c040b3b503675ea95d89af

from php-swagger-test.

byjg avatar byjg commented on August 28, 2024

I'll use this to create the unit tests. Thanks :)

from php-swagger-test.

JohnRoux avatar JohnRoux commented on August 28, 2024

Bearer of bad news :(
That PR didn't actually fix things entirely for allOf.

Context:
I use an Item schema which my models "extend" in their own schema's like this

When running the response validation, I get this error:
ByJG\ApiTools\Exception\NotMatchedException: The property(ies) 'name, email, type, roles_id, companies_id, created_at, updated_at' has not defined in '#/components/schemas/Item'

So it's clearly found the deepest "allOf" and is trying to match the whole object against that. :(

I think the allOfmatching needs to amalgamate an array all the properties from it's children shema/properties and then match against that single array

from php-swagger-test.

pionl avatar pionl commented on August 28, 2024

hi, in our use cases our implementation of allOf works (mentioned in laravel-wrapper), did not have the time to make PR - should i make the time?

from php-swagger-test.

iskrenvankov avatar iskrenvankov commented on August 28, 2024

P.S. a note that enums fall under the same error ByJG\ApiTools\Exception\GenericSwaggerException: Not all cases are defined. Please open an issue about this.

For example:

@OA\Property(
    property="my_enum_property",
    enum={"foo", "bar"}
)

from php-swagger-test.

pionl avatar pionl commented on August 28, 2024

Ok, I'try to make the time today and send PR 👍

from php-swagger-test.

kachar avatar kachar commented on August 28, 2024

Any update on this topic?

from php-swagger-test.

kachar avatar kachar commented on August 28, 2024

@byjg @ODAEL Just tested the PR and it seems it includes only the allOf case and not oneOf scenario so even if that works it still errors with Not all cases are defined

I don't have test setup for allOf so I can't validate that right now.

from php-swagger-test.

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.