Giter VIP home page Giter VIP logo

Comments (5)

bfanger avatar bfanger commented on July 26, 2024

Swagger-php is only able to pick up on inheritance if the doc-block with the @swg\Model is directly above the "class X extends Y" line.

from swagger-php.

seaneble avatar seaneble commented on July 26, 2024

That sounded promising (there is nothing about that anywhere in the documentation I think). But when I tried it didn't work:

/**
 * @SWG\Model(id="User") */
class User extends Person
{

This changes nothing in the JSON.

from swagger-php.

seaneble avatar seaneble commented on July 26, 2024

Now I debugged the parser and it turns out that the Model ID of Swagger and the class name have to be identical – which only appears to be the case in the example I posted up there, because that example is fake and has nothing to do with my code…

It seems like I have to restructure my Model ID system, which I don't really like to do because there is a sense in having names differing from each other (there are mulitple model classes with the same name in different namespaces but they represent different Swagger Models, so I needed to add a suffix to the name).

I don't think Swagger supports something like namespacing for Model IDs. Is there a way to have the Annotations Parser map the name of the extended class to the name of the Swagger Model ID?

from swagger-php.

bfanger avatar bfanger commented on July 26, 2024

I've upgraded the inheritance logic to use the fully qualified classnames instead of the model->ids.

there is nothing about that anywhere in the documentation I think

Contributions to the docs are highly appreciated.
Which are located in the gh-branch: https://github.com/zircote/swagger-php/tree/gh-pages/docs

from swagger-php.

seaneble avatar seaneble commented on July 26, 2024

Okay, thanks for adding this functionality!

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.