Giter VIP home page Giter VIP logo

Comments (2)

bfanger avatar bfanger commented on August 30, 2024

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.

leehicks avatar leehicks commented on August 30, 2024

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

www.dreamfactory.com

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)

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.