Giter VIP home page Giter VIP logo

Comments (6)

DerManoMann avatar DerManoMann commented on July 26, 2024 1

Context might be an option. It's a bit outside of scope but I can see that it would be helpful for some.

from swagger-php.

brettgoss avatar brettgoss commented on July 26, 2024 1

@DerManoMann pulled those changes down and it works great and completely solves what I'm trying to do! Thank you so much!

The only thing I noticed which I'll note here for anyone trying to do something similarly, is that I found I had to explicitly load the external annotations and pass them in to the generator as one of the sources. Otherwise the DocParser wouldn't detect the classes as existing.

Interestingly, that was only an issue for the first file being processed, and every subsequent file would have the additional external annotations.

But that's easy enough to work around by doing something like this (which will explicitly preload the JMS\Serializer annotations that I'm using in the processor):

$openApi = (new \OpenApi\Generator())
	->generate([
		\Symfony\Component\Finder\Finder::create()->files()
			->name('*.php')
			->in('vendor/jms/serializer/src/Annotation'),
		$otherFinders
	]);

from swagger-php.

brettgoss avatar brettgoss commented on July 26, 2024

Do you have an idea how you might implement that? I'm happy to contribute if that would be helpful (or even just fork, if it's not functionality you're wanting to merge in)

from swagger-php.

DerManoMann avatar DerManoMann commented on July 26, 2024

@brettgoss Created a PR that collects unrelated annotations/attributes in Context::other.

The change is implemented for both docblocks and attributes, so your current setup will now break on this.

Let me know if this works for you.

from swagger-php.

DerManoMann avatar DerManoMann commented on July 26, 2024

Very strange - didn't you say you'd get annotations all loaded before?
For docblock all I changed was put them in a different place!
Smells like a autoloading issue to me.

from swagger-php.

brettgoss avatar brettgoss commented on July 26, 2024

Ah yeah, unrelated to the change - just noticed it while I was testing it out.

Anyway, thanks for the assistance! This is a super helpful improvement for our workflow!

from swagger-php.

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.