Comments (6)
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.
@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.
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.
@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.
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.
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)
- readOnly for property of type object HOT 3
- How to create an array while using discriminator
- Support dynamicRef/Anchor HOT 1
- Add custom exception classes
- $ref not found for @OA\Parameter() HOT 1
- DEPRECATION: Since zircote/swagger-php 4.9: Context detecting is deprecated HOT 11
- Explicitly defining operation properties with 3rd party already defining them now causes errors HOT 4
- The Authorization specified in HeaderParameter cannot correctly try it out. HOT 3
- Possible to override Parameter Schema? HOT 3
- Context is missing class attribute HOT 3
- Custom processor for creating annotations programatically HOT 4
- Type required for anyOf defined property. HOT 2
- Dynamically creating schema's based on model properties HOT 6
- Reimplement `TokenScanner` using `nikic/php-parser`
- MediaType issue with JsonContent HOT 14
- Error: Error: Interface "PHP_CodeSniffer\Sniffs\Sniff" not found HOT 2
- First argument of the setProcessorPipeline must be of type OpenApi\Pipeline, null given
- All properties for all schemas became Deprecated HOT 1
- The latest tag and release differ : 4.9.4 vs 4.10.0 ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger-php.