Giter VIP home page Giter VIP logo

Comments (12)

bfanger avatar bfanger commented on August 30, 2024 52
/**
 * @SWG\Parameter(
 *   name="status",
 *   in="query",
 *   type="string",
 *   enum={"pending", "failed", "completed"}
 * )
 */

Documented here and used in the petstore example here

from swagger-php.

itsAnuga avatar itsAnuga commented on August 30, 2024 4

@pakcybershagufta and everyone else:

 *   @OA\Parameter(
 *     @OA\Schema(
 *       default="value1",
 *       type="string",
 *       enum={
 *         "value1",
 *         "value2",
 *       },
 *     ),
 *     description="Value Values.",
 *     example="value1",
 *     in="query",
 *     name="values",
 *     required=true,
 *   ),

Creates a Select with Options, where one value must be chosen, value1 is selected by default.

from swagger-php.

zircote avatar zircote commented on August 30, 2024 3

Currently you can with the following example:

@property string<'Two Pigs','Duck', 'And 1 Cow'> $enumVal This is an enum value.

With the coming changes (Doctrine Annotations) it will look like:

    /**
     *
     *
     * @var string
     *
     * @Property(
     *      type="string",
     *      @allowableValues(
     *          valueType="LIST",
     *          values="['available', 'pending', 'sold']"
     *      ),
     *      description="pet status in the store")
     */
    protected $status;

And the parameter definition in the doctrine annotations looks like:

     *        @parameter(
     *           name="status",
     *           description="Status values that need to be considered for filter",
     *           paramType="query",
     *           defaultValue="available",
     *           @allowableValues(valueType="LIST", values="['available', 'pending', 'sold']"),
     *           required="true",
     *           allowMultiple=true,
     *           dataType="string"
     *         )

from swagger-php.

pietervogelaar avatar pietervogelaar commented on August 30, 2024

Thanks for you response. So currently I figure it's only possible to define it in a model but not as query parameter? Is that correct?

I noticed the Doctrine annotations branch, looks very nice! What's the schedule for it to merge it into the master branch?

from swagger-php.

zircote avatar zircote commented on August 30, 2024

I am hoping to be able to merge it this weekend, it is passing tests now; however I want to get a caching layer in place and perhaps a bit of refactoring if there is time and more importantly documentation of the annotations. SHA: c8b536c046fa3e0fe050a6fc5c9ce871d1be7242 I just pushed and it appears to be fully functional so far more tests would be great.

from swagger-php.

pietervogelaar avatar pietervogelaar commented on August 30, 2024

Awesome that's soon! Yeah, documentation is important I think. At the moment I find myself sometimes looking at the unit tests to see what the correct notation or options are :)

from swagger-php.

zircote avatar zircote commented on August 30, 2024

0.4.0 addresses this and is documented in further detail at http://zircote.com/swagger-php

from swagger-php.

Maykonn avatar Maykonn commented on August 30, 2024

Where this is documented? I can't find on docs.

from swagger-php.

Maykonn avatar Maykonn commented on August 30, 2024

Thanks!

from swagger-php.

pakcybershagufta avatar pakcybershagufta commented on August 30, 2024
/**
 * @SWG\Parameter(
 *   name="status",
 *   in="query",
 *   type="string",
 *   enum={"pending", "failed", "completed"}
 * )
 */

Documented here and used in the petstore example here

Thank you ..great job

from swagger-php.

pakcybershagufta avatar pakcybershagufta commented on August 30, 2024

How set default value in enum and please tell me also how set multi select also like colors colors select multiple colors

from swagger-php.

pakcybershagufta avatar pakcybershagufta commented on August 30, 2024

HOw we use anyOf etc preperty exact format please?

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.