Comments (2)
Internally an array is used to store the properties, but this array is transformed in the Model::jsonSerialize()
which is called automatically when you use (the preferred) $swagger->getResource()
For more more control you can use the Swagger::export()
or $swagger->jsonEncode()
PS: swagger-php 0.6 no longer requires pure class representation for models, they can be declared anywhere, like so:
/**
* @SWG\Model(id="Pet",
* @SWG\Property(name="status",type="int"),
* @SWG\Property(name="statusName",type="string"),
* @SWG\Property(name="tags",type="Array", items="$ref:Tag")
* )
*/
from swagger-php.
I see what I was doing wrong. I was pulling the models directly out of the
registry (to add some more dynamic pieces) and then json encoding at a
later point, not using export(). I wasn't using the getResource, but I will
once I get my model declarations correct.
Also, the model declaration you mentioned is exactly what I was looking
for. Maybe you could update the swagger-php documentation to reflect that
when time permits.
0.6@dev is much improved!
Thanks,
Lee Hicks
On Thu, May 9, 2013 at 6:16 PM, Bob Fanger [email protected] wrote:
Internally an array is used to store the properties, but this array is
transformed in the Model::jsonSerialize() which is called automatically
when you use (the preferred) $swagger->getResource()
For more more control you can use the Swagger::export() or
$swagger->jsonEncode()PS: swagger-php 0.6 no longer requires pure class representation for
models, they can be declared anywhere, like so:/* * @swg\Model(id="Pet", * @swg\Property(name="status",type="int"), * @swg\Property(name="statusName",type="string"), * @swg\Property(name="tags",type="Array", items="$ref:Tag") * )/
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/81#issuecomment-17693412
.
from swagger-php.
Related Issues (20)
- The latest tag and release differ : 4.9.4 vs 4.10.0 ? HOT 1
- Unable to group HOT 9
- [Feature]: Append "tags" list via Operation attribute HOT 3
- Parameters in laravel seem a bit too troublesome HOT 4
- Improve processor reference
- Possible BC Break in 4.10.1 HOT 4
- Validation fails with repeated tags since v4.10.1 HOT 3
- Global unified configuration suggestions
- Filtering not done as expected HOT 4
- How to set deepObject properties type HOT 1
- removeAnnotation performance HOT 1
- Fatal error "Nesting level too deep - recursive dependency?" HOT 2
- Tags within api definition are not unique HOT 2
- No output on CLI HOT 1
- How to work with discriminator?
- Schema generation fails inside JsonContent HOT 2
- Schema generator add illegal request key under requestBody HOT 5
- Operation security is invalid
- Default OpenAPI Version from RootContext overwrites OpenAPI Version from OpenApi Property HOT 4
- Duplicate tags will not be filtered out HOT 8
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.