How to pass multi dimension array into swagger? - swagger

I am using "nelmio/api-doc-bundle" 4.9 and I need to pass multi-dimenional array using swagger. In postman I am passing like this.
So far, I have tried this in swagger.
* #OA\Parameter(
* name="banner[]",
* in="query",
* description="Banner information",
* required=true,
* #OA\Schema(
* type="array",
* #OA\Items(
* type="array",
* #OA\Items(type="string", propertyNames="startDate")
* )
* ),
* ),

Related

How to apply Custom Shader Program with Fabric.js

For applying the custom shader Rain Drop program in the fabric.js (core library) and calling the rain-drop effect from separate program I have done the following :-
1) I have downloaded the fabric dependency from fabric-npm- version 5.3.0
2) Because I need to implement a Rain Drop program in the fabric.js, I have created one source file rain_drop.class.js below is the code snippet
/**
* Rain Drop Effect class
*/
(function(global) {
'use strict';
var fabric = global.fabric || (global.fabric = { }),
filters = fabric.Image.filters,
createClass = fabric.util.createClass;
filters.RainDrop = createClass(filters.BaseFilter, {
/**
* Filter type
* #param {String} type
* #default
*/
type: 'RainDrop',
fragmentSource : "#define MAX_RADIUS 2\n precision highp float;\n #define DOUBLE_HASH 0\n #define HASHSCALE1 .1031\n #define HASHSCALE3 vec3(.1031, .1030, .0973)\n #define RANSIZE 0.7 \n #define RAINSPEED 0.3 \n \n uniform float iTime;\n uniform sampler2D uTexture;\n varying vec2 vTexCoord;\n \n float hash12(vec2 p)\n {\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n \n vec2 hash22(vec2 p)\n {\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE3);\n p3 += dot(p3, p3.yzx+19.19);\n return fract((p3.xx+p3.yz)*p3.zy);\n \n }\n \n void main(){\n \n vec3 iResolution; \n iResolution = vec3(1.0, 1.0, 1.0); \n float resolution = 10. * exp2(-3.*RANSIZE);\n vec2 uv = gl_FragCoord.xy / iResolution.y * resolution;\n vec2 uv2 = gl_FragCoord.xy / iResolution.xy* resolution;\n vec2 p0 = floor(uv);\n \n vec2 circles = vec2(0.);\n for (int j = -MAX_RADIUS; j <= MAX_RADIUS; ++j)\n {\n for (int i = -MAX_RADIUS; i <= MAX_RADIUS; ++i)\n {\n vec2 pi = p0 + vec2(i, j);\n #if DOUBLE_HASH\n vec2 hsh = hash22(pi);\n #else\n vec2 hsh = pi;\n #endif\n vec2 p = pi + hash22(hsh);\n \n float t = fract(RAINSPEED*iTime + hash12(hsh));\n vec2 v = p - uv;\n float d = length(v) - (float(MAX_RADIUS) + 1.)*t;\n \n float h = 1e-3;\n float d1 = d - h;\n float d2 = d + h;\n float p1 = sin(31.*d1) * smoothstep(-0.6, -0.3, d1) * smoothstep(0., -0.3, d1);\n float p2 = sin(31.*d2) * smoothstep(-0.6, -0.3, d2) * smoothstep(0., -0.3, d2);\n circles += 0.5 * normalize(v) * ((p2 - p1) / (2. * h) * (1. - t) * (1. - t));\n }\n }\n circles /= float((MAX_RADIUS*2+1)*(MAX_RADIUS*2+1));\n \n float intensity = mix(0.01, 0.15, smoothstep(0.1, 0.6, abs(fract(0.05*iTime + 0.5)*2.-1.)));\n vec3 n = vec3(circles, sqrt(1. - dot(circles, circles)));\n vec3 color = texture2D(uTexture, uv2/resolution - intensity*n.xy).rgb + 5.*pow(clamp(dot(n, normalize(vec3(1., 0.7, 0.5))), 0., 1.), 6.);\n gl_FragColor = vec4(color, 1.0);\n }",
/**
* iTime value, from 1 to 10.
* #param {Number} iTime
*/
iTime: 0,
/**
* Describe the property that is the filter parameter
* #param {String} m
* #default
*/
mainParameter: 'iTime',
/**
* Apply the Brightness operation to a Uint8ClampedArray representing the pixels of an image.
*
* #param {Object} options
* #param {ImageData} options.imageData The Uint8ClampedArray to be filtered.
*/
applyTo2d: function(options) {
if (this.iTime === 0) {
return;
}
},
/**
* Return WebGL uniform locations for this filter's shader.
*
* #param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.
* #param {WebGLShaderProgram} program This filter's compiled shader program.
*/
getUniformLocations: function(gl, program) {
return {
iTime: gl.getUniformLocation(program, 'iTime'),
};
},
/**
* Send data from this filter to its shader program's uniforms.
*
* #param {WebGLRenderingContext} gl The GL canvas context used to compile this filter's shader.
* #param {Object} uniformLocations A map of string uniform names to WebGLUniformLocation objects
*/
sendUniformData: function(gl, uniformLocations) {
gl.uniform1f(uniformLocations.iTime, Math.random());
},
});
/**
* Returns filter instance from an object representation
* #static
* #param {Object} object Object to create an instance from
* #param {function} [callback] to be invoked after filter creation
* #return {fabric.Image.filters.Brightness} Instance of fabric.Image.filters.Brightness
*/
fabric.Image.filters.BlurITT.fromObject = fabric.Image.filters.BaseFilter.fromObject;
})(typeof exports !== 'undefined' ? exports : this);
3. Adding the rain_drop effect in 'src/build.js' through the below code
ifSpecifiedInclude('image_filters', 'src/filters/rain_drop.class.js')
4. Now I need to recompile the fabric program through npm run build and this invokes below command in package.json
"build": "node build.js modules=ALL requirejs exclude=gestures,accessors,erasing",
5. I can get fabric.min.js under the 'fabric/dist' folder, that I can use as a library for separate program
6. calling the added filter through this way
var filter = new fabric.Image.filters.RainDrop({
iTime: 2.04
});
Here is the correct output that I need to achieve
But, I am getting the wrong output for the rain-drop effect
I know, something wrong with the shader program but Please If anyone who has good knowledge in this domain can jump in and share their thoughts.
Also sorry for the inadequate question formatting, If anyone can improve the question formatting that will be also helpful.
Thanks

upgrading rails issue (Could not find gem 'rails (~> 5.2.8, >= 5.2.8.15)' in rubygems repository https://rubygems.org/ or installed locally.)

So, I have the following security vulnerability in activesupport, activerecord and actionpack.
Name: actionpack
Version: 5.2.8.1
CVE: CVE-2023-22792
GHSA: GHSA-p84v-45xj-wwqj
Criticality: Unknown
URL: https://github.com/rails/rails/releases/tag/v7.0.4.1
Title: ReDoS based DoS vulnerability in Action Dispatch
Solution: upgrade to '~> 5.2.8, >= 5.2.8.15', '~> 6.1.7, >= 6.1.7.1', '>= 7.0.4.1'
Name: activerecord
Version: 5.2.8.1
CVE: CVE-2022-44566
GHSA: GHSA-579w-22j4-4749
Criticality: Unknown
URL: https://github.com/rails/rails/releases/tag/v7.0.4.1
Title: Denial of Service Vulnerability in ActiveRecord’s PostgreSQL adapter
Solution: upgrade to '~> 5.2.8, >= 5.2.8.15', '~> 6.1.7, >= 6.1.7.1', '>= 7.0.4.1'
Name: activesupport
Version: 5.2.8.1
CVE: CVE-2023-22796
GHSA: GHSA-j6gc-792m-qgm2
Criticality: Unknown
URL: https://github.com/rails/rails/releases/tag/v7.0.4.1
Title: ReDoS based DoS vulnerability in Active Support’s underscore
Solution: upgrade to '~> 5.2.8, >= 5.2.8.15', '~> 6.1.7, >= 6.1.7.1', '>= 7.0.4.1'
my rails version from gemfile
gem 'rails', '~> 5.2.8', '>= 5.2.8.1'
as the solution suggests upgrade to '~> 5.2.8, >= 5.2.8.15' seems to be the next step. so I changed the gemfile as follows:
gem 'rails', '~> 5.2.8', '>= 5.2.8.15'
and then bundle install' | I've also done bundle update` which produces the same output as the following
Fetching gem metadata from https://rubygems.org/..........
Could not find gem 'rails (~> 5.2.8, >= 5.2.8.15)' in rubygems repository https://rubygems.org/ or installed locally.
The source contains the following gems matching 'rails':
* rails-0.8.0
* rails-0.8.5
* rails-0.9.0
* rails-0.9.1
* rails-0.9.2
* rails-0.9.3
* rails-0.9.4
* rails-0.9.4.1
* rails-0.9.5
* rails-0.10.0
* rails-0.10.1
* rails-0.11.0
* rails-0.11.1
* rails-0.12.0
* rails-0.12.1
* rails-0.13.0
* rails-0.13.1
* rails-0.14.1
* rails-0.14.2
* rails-0.14.3
* rails-0.14.4
* rails-1.0.0
* rails-1.1.0
* rails-1.1.1
* rails-1.1.2
* rails-1.1.3
* rails-1.1.4
* rails-1.1.5
* rails-1.1.6
* rails-1.2.0
* rails-1.2.1
* rails-1.2.2
* rails-1.2.3
* rails-1.2.4
* rails-1.2.5
* rails-1.2.6
* rails-2.0.0
* rails-2.0.1
* rails-2.0.2
* rails-2.0.4
* rails-2.0.5
* rails-2.1.0
* rails-2.1.1
* rails-2.1.2
* rails-2.2.2
* rails-2.2.3
* rails-2.3.2
* rails-2.3.3
* rails-2.3.4
* rails-2.3.5
* rails-2.3.6
* rails-2.3.7
* rails-2.3.8.pre1
* rails-2.3.8
* rails-2.3.9.pre
* rails-2.3.9
* rails-2.3.10
* rails-2.3.11
* rails-2.3.12
* rails-2.3.14
* rails-2.3.15
* rails-2.3.16
* rails-2.3.17
* rails-2.3.18
* rails-3.0.0.beta
* rails-3.0.0.beta2
* rails-3.0.0.beta3
* rails-3.0.0.beta4
* rails-3.0.0.rc
* rails-3.0.0.rc2
* rails-3.0.0
* rails-3.0.1
* rails-3.0.2
* rails-3.0.3
* rails-3.0.4.rc1
* rails-3.0.4
* rails-3.0.5.rc1
* rails-3.0.5
* rails-3.0.6.rc1
* rails-3.0.6.rc2
* rails-3.0.6
* rails-3.0.7.rc1
* rails-3.0.7.rc2
* rails-3.0.7
* rails-3.0.8.rc1
* rails-3.0.8.rc2
* rails-3.0.8.rc4
* rails-3.0.8
* rails-3.0.9.rc1
* rails-3.0.9.rc3
* rails-3.0.9.rc4
* rails-3.0.9.rc5
* rails-3.0.9
* rails-3.0.10.rc1
* rails-3.0.10
* rails-3.0.11
* rails-3.0.12.rc1
* rails-3.0.12
* rails-3.0.13.rc1
* rails-3.0.13
* rails-3.0.14
* rails-3.0.15
* rails-3.0.16
* rails-3.0.17
* rails-3.0.18
* rails-3.0.19
* rails-3.0.20
* rails-3.1.0.beta1
* rails-3.1.0.rc1
* rails-3.1.0.rc2
* rails-3.1.0.rc3
* rails-3.1.0.rc4
* rails-3.1.0.rc5
* rails-3.1.0.rc6
* rails-3.1.0.rc8
* rails-3.1.0
* rails-3.1.1.rc1
* rails-3.1.1.rc2
* rails-3.1.1.rc3
* rails-3.1.1
* rails-3.1.2.rc1
* rails-3.1.2.rc2
* rails-3.1.2
* rails-3.1.3
* rails-3.1.4.rc1
* rails-3.1.4
* rails-3.1.5.rc1
* rails-3.1.5
* rails-3.1.6
* rails-3.1.7
* rails-3.1.8
* rails-3.1.9
* rails-3.1.10
* rails-3.1.11
* rails-3.1.12
* rails-3.2.0.rc1
* rails-3.2.0.rc2
* rails-3.2.0
* rails-3.2.1
* rails-3.2.2.rc1
* rails-3.2.2
* rails-3.2.3.rc1
* rails-3.2.3.rc2
* rails-3.2.3
* rails-3.2.4.rc1
* rails-3.2.4
* rails-3.2.5
* rails-3.2.6
* rails-3.2.7.rc1
* rails-3.2.7
* rails-3.2.8.rc1
* rails-3.2.8.rc2
* rails-3.2.8
* rails-3.2.9.rc1
* rails-3.2.9.rc2
* rails-3.2.9.rc3
* rails-3.2.9
* rails-3.2.10
* rails-3.2.11
* rails-3.2.12
* rails-3.2.13.rc1
* rails-3.2.13.rc2
* rails-3.2.13
* rails-3.2.14.rc1
* rails-3.2.14.rc2
* rails-3.2.14
* rails-3.2.15.rc1
* rails-3.2.15.rc2
* rails-3.2.15.rc3
* rails-3.2.15
* rails-3.2.16
* rails-3.2.17
* rails-3.2.18
* rails-3.2.19
* rails-3.2.20
* rails-3.2.21
* rails-3.2.22
* rails-3.2.22.1
* rails-3.2.22.2
* rails-3.2.22.3
* rails-3.2.22.4
* rails-3.2.22.5
* rails-4.0.0.beta1
* rails-4.0.0.rc1
* rails-4.0.0.rc2
* rails-4.0.0
* rails-4.0.1.rc1
* rails-4.0.1.rc2
* rails-4.0.1.rc3
* rails-4.0.1.rc4
* rails-4.0.1
* rails-4.0.2
* rails-4.0.3
* rails-4.0.4.rc1
* rails-4.0.4
* rails-4.0.5
* rails-4.0.6.rc1
* rails-4.0.6.rc2
* rails-4.0.6.rc3
* rails-4.0.6
* rails-4.0.7
* rails-4.0.8
* rails-4.0.9
* rails-4.0.10.rc1
* rails-4.0.10.rc2
* rails-4.0.10
* rails-4.0.11
* rails-4.0.11.1
* rails-4.0.12
* rails-4.0.13.rc1
* rails-4.0.13
* rails-4.1.0.beta1
* rails-4.1.0.beta2
* rails-4.1.0.rc1
* rails-4.1.0.rc2
* rails-4.1.0
* rails-4.1.1
* rails-4.1.2.rc1
* rails-4.1.2.rc2
* rails-4.1.2.rc3
* rails-4.1.2
* rails-4.1.3
* rails-4.1.4
* rails-4.1.5
* rails-4.1.6.rc1
* rails-4.1.6.rc2
* rails-4.1.6
* rails-4.1.7
* rails-4.1.7.1
* rails-4.1.8
* rails-4.1.9.rc1
* rails-4.1.9
* rails-4.1.10.rc1
* rails-4.1.10.rc2
* rails-4.1.10.rc3
* rails-4.1.10.rc4
* rails-4.1.10
* rails-4.1.11
* rails-4.1.12.rc1
* rails-4.1.12
* rails-4.1.13.rc1
* rails-4.1.13
* rails-4.1.14.rc1
* rails-4.1.14.rc2
* rails-4.1.14
* rails-4.1.14.1
* rails-4.1.14.2
* rails-4.1.15.rc1
* rails-4.1.15
* rails-4.1.16.rc1
* rails-4.1.16
* rails-4.2.0.beta1
* rails-4.2.0.beta2
* rails-4.2.0.beta3
* rails-4.2.0.beta4
* rails-4.2.0.rc1
* rails-4.2.0.rc2
* rails-4.2.0.rc3
* rails-4.2.0
* rails-4.2.1.rc1
* rails-4.2.1.rc2
* rails-4.2.1.rc3
* rails-4.2.1.rc4
* rails-4.2.1
* rails-4.2.2
* rails-4.2.3.rc1
* rails-4.2.3
* rails-4.2.4.rc1
* rails-4.2.4
* rails-4.2.5.rc1
* rails-4.2.5.rc2
* rails-4.2.5
* rails-4.2.5.1
* rails-4.2.5.2
* rails-4.2.6.rc1
* rails-4.2.6
* rails-4.2.7.rc1
* rails-4.2.7
* rails-4.2.7.1
* rails-4.2.8.rc1
* rails-4.2.8
* rails-4.2.9.rc1
* rails-4.2.9.rc2
* rails-4.2.9
* rails-4.2.10.rc1
* rails-4.2.10
* rails-4.2.11
* rails-4.2.11.1
* rails-4.2.11.2
* rails-4.2.11.3
* rails-5.0.0.beta1
* rails-5.0.0.beta1.1
* rails-5.0.0.beta2
* rails-5.0.0.beta3
* rails-5.0.0.beta4
* rails-5.0.0.racecar1
* rails-5.0.0.rc1
* rails-5.0.0.rc2
* rails-5.0.0
* rails-5.0.0.1
* rails-5.0.1.rc1
* rails-5.0.1.rc2
* rails-5.0.1
* rails-5.0.2.rc1
* rails-5.0.2
* rails-5.0.3
* rails-5.0.4.rc1
* rails-5.0.4
* rails-5.0.5.rc1
* rails-5.0.5.rc2
* rails-5.0.5
* rails-5.0.6.rc1
* rails-5.0.6
* rails-5.0.7
* rails-5.0.7.1
* rails-5.0.7.2
* rails-5.1.0.beta1
* rails-5.1.0.rc1
* rails-5.1.0.rc2
* rails-5.1.0
* rails-5.1.1
* rails-5.1.2.rc1
* rails-5.1.2
* rails-5.1.3.rc1
* rails-5.1.3.rc2
* rails-5.1.3.rc3
* rails-5.1.3
* rails-5.1.4.rc1
* rails-5.1.4
* rails-5.1.5.rc1
* rails-5.1.5
* rails-5.1.6
* rails-5.1.6.1
* rails-5.1.6.2
* rails-5.1.7.rc1
* rails-5.1.7
* rails-5.2.0.beta1
* rails-5.2.0.beta2
* rails-5.2.0.rc1
* rails-5.2.0.rc2
* rails-5.2.0
* rails-5.2.1.rc1
* rails-5.2.1
* rails-5.2.1.1
* rails-5.2.2.rc1
* rails-5.2.2
* rails-5.2.2.1
* rails-5.2.3.rc1
* rails-5.2.3
* rails-5.2.4.rc1
* rails-5.2.4
* rails-5.2.4.1
* rails-5.2.4.2
* rails-5.2.4.3
* rails-5.2.4.4
* rails-5.2.4.5
* rails-5.2.4.6
* rails-5.2.5
* rails-5.2.6
* rails-5.2.6.1
* rails-5.2.6.2
* rails-5.2.6.3
* rails-5.2.7
* rails-5.2.7.1
* rails-5.2.8
* rails-5.2.8.1
* rails-6.0.0.beta1
* rails-6.0.0.beta2
* rails-6.0.0.beta3
* rails-6.0.0.rc1
* rails-6.0.0.rc2
* rails-6.0.0
* rails-6.0.1.rc1
* rails-6.0.1
* rails-6.0.2.rc1
* rails-6.0.2.rc2
* rails-6.0.2
* rails-6.0.2.1
* rails-6.0.2.2
* rails-6.0.3.rc1
* rails-6.0.3
* rails-6.0.3.1
* rails-6.0.3.2
* rails-6.0.3.3
* rails-6.0.3.4
* rails-6.0.3.5
* rails-6.0.3.6
* rails-6.0.3.7
* rails-6.0.4
* rails-6.0.4.1
* rails-6.0.4.2
* rails-6.0.4.3
* rails-6.0.4.4
* rails-6.0.4.5
* rails-6.0.4.6
* rails-6.0.4.7
* rails-6.0.4.8
* rails-6.0.5
* rails-6.0.5.1
* rails-6.0.6
* rails-6.0.6.1
* rails-6.1.0.rc1
* rails-6.1.0.rc2
* rails-6.1.0
* rails-6.1.1
* rails-6.1.2
* rails-6.1.2.1
* rails-6.1.3
* rails-6.1.3.1
* rails-6.1.3.2
* rails-6.1.4
* rails-6.1.4.1
* rails-6.1.4.2
* rails-6.1.4.3
* rails-6.1.4.4
* rails-6.1.4.5
* rails-6.1.4.6
* rails-6.1.4.7
* rails-6.1.5
* rails-6.1.5.1
* rails-6.1.6
* rails-6.1.6.1
* rails-6.1.7
* rails-6.1.7.1
* rails-6.1.7.2
* rails-7.0.0.alpha1
* rails-7.0.0.alpha2
* rails-7.0.0.rc1
* rails-7.0.0.rc2
* rails-7.0.0.rc3
* rails-7.0.0
* rails-7.0.1
* rails-7.0.2
* rails-7.0.2.1
* rails-7.0.2.2
* rails-7.0.2.3
* rails-7.0.2.4
* rails-7.0.3
* rails-7.0.3.1
* rails-7.0.4
* rails-7.0.4.1
* rails-7.0.4.2
What am I doing wrong. how can i upgrade those three (activesupport, activerecord and actionpack)?
After defining new rules and versions in your Gemfile, run:
bundle update rails
This will update all direct dependencies of Rails too.
But! be sure the version exists on RubyGems: https://rubygems.org/gems/rails/versions (it seems that v5.2.8.15 does not exist).

How can i send an object as a parameter in Swagger Documentation

i'm using Swagger to document my Lumen API and im using annotations. The thing is, i don't know how to achieve the structure that you can see on the picture with annotations
Can anyone help me with this?
I finally found the answer to this and how to get the structure that i wanted:
#OA\RequestBody(
* #OA\JsonContent(
* type="object",
* #OA\Property(property="idNumber", type="string"),
* #OA\Property(property="ClientId", type="string"),
* #OA\Property(property="inspection", type="array",
* #OA\Items(type="object", properties = {
* #OA\Property(property="Color", type="string"),
* #OA\Property(property="time", type="string"),
* #OA\Property(property="place", type="string"),
* #OA\Property(property="issue", type="string"),
* #OA\Property(property="details", type="string"),
* }),
* ),
* #OA\Property(property="detailId", type="string"),
* #OA\Property(property="WayPayment", type="array",
* #OA\Items(type="object", properties = {
* #OA\Property(property="banking", type="string"),
* #OA\Property(property="numbercard", type="string"),
* #OA\Property(property="numberpayment", type="string"),
* }),
* ),
* ),
* ),

How to specify the default JSON body in Swagger-PHP?

I want to specify the default JSON body for a POST request in Swagger-PHP. My annotations look like this:
/**
* Setup order
*
* #SWG\Post(
* path="/order/setup",
* operationId="setupOrder",
* tags={"Orders"},
* summary="Setup an order with status draft.",
* description="Setup an order with status draft",
* consumes={"application/json"},
* #SWG\Parameter(
* name="body",
* in="body",
* default="{}",
* description="Json order info body (customer and products info)",
* required=true,
* #SWG\Schema(type="string")
* ),
* #SWG\Response(
* response=200,
* description="successful operation"
* ),
* #SWG\Response(response=400, description="Bad request"),
* security={
* {"api_key_security_example": {}}
* }
* )
*
*/
As you can see I'm trying to achieve the default value with default="{}", but Swagger UI ignores this value and places 'string' instead as default value:
How can I change the 'string' part to a default JSON object?
You can achieve as you expected by modifying your #SWG\Parameter().
Example (look at example of the property):
* #SWG\Parameter(
* name="body",
* in="body",
* description="User email used to create account.",
* required=true,
* #SWG\Schema(#SWG\Property(property="email", type="string", example="email#example.com")),
* )
You can use like below.
/**
* Setup order
* #SWG\Post(
* path="/order/setup",
* operationId="setupOrder",
* tags={"Orders"},
* summary="Setup an order with status draft.",
* description="Setup an order with status draft",
* consumes={"application/json"},
* #SWG\Parameter(
* name="body",
* in="body",
* default="{}",
* description="Json order info body (customer and products info)",
* required=true,
* #SWG\Schema(ref="#/definitions/testDefinitions")
* ),
* #SWG\Response(
* response=200,
* description="successful operation"
* ),
* #SWG\Response(response=400, description="Bad request"),
* security={
* {"api_key_security_example": {}}
* }
* )
* #SWG\Definition(
* definition="PlanResponse",
* example={
* "type":"string"
* }
* )
*/
Thanks,

Can't get array key to work with Swagger

/**
* #SWG\POST(
* path="/visa-entry/calculate",
* operationId="visaEntryCalculate",
* tags={"Visa Entry"},
* summary="Calculate the price for an array of visa entries",
* description="Calculate the price for an array of visa entries",
*
* #SWG\Parameter(
* name="entries",
* in="body",
* description="Visa Entry IDs to calculate to total price",
* required=true,
* #SWG\Schema(
* type="array",
* #SWG\Items(type="number")
* ),
* collectionFormat="multi"
* ),
*
* #SWG\Response(
* response=200,
* description="OK"
* ),
*
* #SWG\Response(
* response=400,
* description="Bad request"
* ),
* )
*
* Calculates a visa entry
*/
What I'm trying to do is to receive an Array of numbers with the key entries.
entries: [1, 2, 3]
This docblock renders the following CURL.
curl -X POST "app.test/visa-entry/calculate" -H "accept: application/json" -H "Content-Type: application/json" -H "X-CSRF-TOKEN: " -d "[0]"
How can I get it to send the array with the key entries?
If you don't want the client to post the array directly in the request-body, but with a key, you'll need to specify the in=body parameter as type="object" and define the array as a property of that schema.
Like this:
/**
* #SWG\POST(
* path="/visa-entry/calculate",
* operationId="visaEntryCalculate",
* tags={"Visa Entry"},
* summary="Calculate the price for an array of visa entries",
* description="Calculate the price for an array of visa entries",
*
* #SWG\Parameter(
* in="body",
* name="json",
* description="Visa Entry IDs to calculate to total price",
* required=true,
* #SWG\Schema(
* type="object",
* #SWG\Property(
* property="entries",
* type="array",
* #SWG\Items(type="number")
* )
* ),
* collectionFormat="multi"
* ),
*
* #SWG\Response(
* response=200,
* description="OK"
* ),
*
* #SWG\Response(
* response=400,
* description="Bad request"
* ),
* )
*
* Calculates a visa entry
*/

Resources