reference,swagger,swagger-2.0 , Is it possible to define a parameter set and reference it?

Is it possible to define a parameter set and reference it?


Tag: reference,swagger,swagger-2.0

I have multiple parameters that I want to reference, but I do not want to specify them one by one.

This snippet does not make the parameters show up:

    "paths": {
        "/stuff": {
            "get": {
                "description": "Gets stuff",
                "operationId": "getStuff",
                "parameters": {
                    "$ref": "#/definitions/set1"
    "parameters": {
        "a": {
            "name": "a",
            "in": "query",
            "description": "Param A",
            "required": false,
            "type": "string"
        "b": {
            "name": "b",
            "in": "query",
            "description": "Param B",
            "required": false,
            "type": "string"
    "definitions": {
        "set1": [
                "$ref": "#/parameters/a"
                "$ref": "#/parameters/b"
       "set2": ...

Is this possible or do I have to specify each parameter like set1, for each request?


Indeed that's not a valid definition and as you suggested, you'd have to specify each parameter separately by referencing the global one. If your parameters are shared for all operations under a specific path, you can define those at the path level and they would be applied to all operations.

For an individual operation, you'd define it as:

"paths": {
  "/stuff": {
    "get": {
      "description": "Gets stuff",
      "operationId": "getStuff",
      "parameters": [
          "$ref": "#/parameters/a"
          "$ref": "#/parameters/b"


Document Restful API created in Node.JS

I have created Restful APIs in Node.js and now I plan to document them so they can be shared with others. I spent the past couple of days researching in to this and I found Swagger and started exploring what it had to offer. I really like Swagger-UI, It takes...

AngularJS - ReferenceError: $ is not defined

I'm getting the following error when I try to do this var fbcanvas = $('#fbcanvas'); This is the error I got ReferenceError: $ is not defined This is my JS code var feedbackModule = angular.module('feedbackModule', [ 'ui.bootstrap', 'dialogs' ]); feedbackModule.controller('feedbackDialog', function($scope, $rootScope, $timeout, $dialogs) { $scope.confirmed = 'You have yet...

Sublists in a 2D List, Referencing

I have a 2D List of objects. I'm trying to access a list and replace it with a sublist of itself. I made up a simple example below, I want to replace dList.get(0) with dList.get(0).subList(1,3). I use a reference variable, which updates the values in the original list, but the...

Why does this code in java print a reference instead the result of invoking the method?

I am supposed to write a method that accepts 3 2-D arrays of This method should determine whether one of the matrices is the result of matrix addition of the other two. public class Matrix { public static void main(String[]args){ int [][] a = {{5,2,3},{4,1,6},{0,7,2}}; int [][] b = {{1,2,3},{4,5,6},{0,1,2}};...

Backslash before a subroutine call

As I was understanding the difference between [] and \ in references,I used both on subroutine the former was fine but when I tried later I thought it should give error but the below program in perl #!/usr/bin/perl use strict; use warnings; use Data::Dumper; my @b; for my $i (...

Java Pass-by-reference not working?

I'm trying to make this little game in Java but I seem to have stumbled upon a variable reference problem. My Entity class, which Player extends from, keeps a variable of type Dimension. This Dimension gets set via the constructor of the Entity class like so: protected Dimension dimension; public...

Object passed by reference will not exist. Swift

I have an array. var array:[customType] = [] // pseudo code func Generate_New_Array(){ //initialization of generatedNewArray array = generatedNewArray for (index,element) in array{ async_process({ Update_Data_From_Web(&array[index]) }) } }) } func Update_Data_From_Web(inout object:customType){ download_process{ object = downloadedData } } The question is , what will should I do if I call...

Java : setting object to null within a method has no effect (Reusing code)

I am trying to write a method to delete a Node from a Binary Search Tree. Here is my method to delete a node. public void delete(int deletionNodeValue) { Node<Integer> nodeToBeDeleted = getNode(deletionNodeValue); if(nodeToBeDeleted == null) return; // No node with such value exists throw an error if(isLeafNode(nodeToBeDeleted)) { nodeToBeDeleted...

Why does this program compile fine in C++14 but not in a C++11 compiler?

I recently tested the simple following program on an online compiler. See live demo here. It compiles fine & gives the expected output but when I tested it on Dev C++ IDE it fails during the compilation. Here is my program: #include <iostream> class Test { int s=9; public: int...

Swagger is not generating @Api resources

I'm trying to integrate Swagger to document my REST API. I have followed this tutorial verbatim: and it works peroperly. I see: { apiVersion: "1.0", swaggerVersion: "1.2" } Now, I want to register one endpoint: @Path("endpoint") @Api(value = "/endpoint", description = "My first documented endpoint") public class MyEndpoint {...

Function with constant reference as input

I am trying to make a function that takes a constant reference of a string as input and returns the string after each character of the string is rotated 1 place to the right. Using references and pointers still confuses me and I am not sure how to obtain the...

Visual studio does not exist in the namespace, but reference is added

I am building a custom code coverage app using the Microsoft.VisualStudio.Coverage.Analysis class. I have added the reference to the dll to my solution already and when I start typing the using statement at the top of my class Visual Studio is predicting the correct names, e.g. after typing "Microsoft." "VisualStudio"...

c++ 2 ref classes should have acess to one same object of a other class

I have 2 classes let's say class a und b. And even a thrid class c. class a and b should have acess to the functions of the same object of class c. I want to have a member like a reference. So the argument in the construktor of class...

Using Swashbuckle to Host an Existing Swagger.JSON file,,swagger,swashbuckle
I have an existing Swagger.json file for a .NET WebApi site which I would like to integrate with my developer site (which is at a different url) running Swashbuckle. Can I simply copy this swagger.json file to the mvc site (content or app_data folder and do this?) If I can,...

Assign a reference return value to a non-reference variable

class A { ... }; A& getA(); A anA = getA(); What happens exactly on line 3 ? Is the copy constructor of A called, thus creating an object independent from the one returned (by reference) by the function?...

passing arguments via reference and pointer C++

I am looking at a code snippet and I have this sequence. class MyVariable { .... CustomType z; .... } A.cpp calling a function f ( & myVariable) In an included file I do have this : B.h void f ( MyVariable * myVariable); B.cpp f( MyVariable * myVariable){ CustomType...

Using NON static class Methods Without reference

I'm new to Java. I know the concept of static and non static method. I'm wondering if it's possible to use non static methods of a class without having to create a reference to it. Like for example, for my program I'm working with Date objects, and I need to...

return reference of static member variable c++

Is there any problem to return a reference of a static member variable? (Reference to avoid copy cost) Vector accepts 4 parameters(x,y,z,w); .h class MyClass { private: static const Vector POS; } .cpp const Vector MyClass::POS(100,300,0,0); const Vector& MyClass::GetVector() { return POS; } ...

How to make a field in a definition required for some operations and not others

I'm writing my swagger definition in yaml. Say I have a definition that looks something like this. paths: /payloads: post: summary: create a payload ... parameters: - in: body name: payload description: New payload required: true schema: $ref: "#/definitions/payload" put: summary: update a payload ... parameters: - in: body name:...

Is a Java class variable a reference to a class object?

I know such question has been asked before but I couldn't find a satisfactory answer. Assume a java class : class Foo{ public int k; Foo(int a){ k=a; } } class My{ public static void main(String args[]){ Foo obj = new Foo(5);//1 obj=new Foo(8); //2 } } I want to...

Access to reference in member variable discards constness

I made a wrapper around an object in my code that should modify accesses to the object. I choose to use an object here for testing instead of a functor that would have the same functionality. Basically: The wrapper receives a reference to the object and forwards all indexed accesses...

Python: how to reference values in a def

As a very basic example of what I want to do, I want to update the values 1 and 2, after running them through the example method. Like how you would use ref for Java. def example(value1, value2): value1 += 2 value2 += 4 value1 = 0 value2 = 0...

Use code from repository that has no

Is there a best practice for how to use code from a python github repository that is missing its file? Since I cannot reference it through my own requirements.txt, may I just copy the code into one of my own files? Specifically, I want to use the function tile_raster_images(...)...

C++ - Why does 2 local references to the same object stay in sync?

I would like to understand what's going on here. Obviously, there's some aspect of references or assignment operators that I am not getting right. Objective: Within a function, I want to work with 2 local reference variables to various elements of the same list: one is the iterated over and...

API Manager: Set API icon in Swagger 2.0 definition?

Is it possible to define an API icon in the Swagger 2.0 definition that will be shown on the app developers page? Or is it at least possible to set an API icon in the API Manager UI? I could not find anything related. ...

how to use one core project for a SQL Server 2014 and Azure SQL Database

we want to deploy our Software on different editions of SQL Server. So we made a CoreDB Project, and for every edition (Express, Standard, Enterprise) seperate projects. Each references the CoreDB to reduce the amount of objects to define. Now we want to deploy to Azure DB, but we can...

Why does my value change when I am not resetting it?

I have the following example exhibiting the problem I'm struggling to resolve. In the toy example, I have an array @actors with two levels. I also have an array of hashes @people which I am using to 'look up' properties of the people in @actors. The output of the program...

System.Windows.Interactivity must be referenced in the main project

So I have a WPF project and my interface in a different project than the main one. I went to reference System.Windows.Interactivity, but it would not work. Not until I added it as a reference to the main project as well... This is the first time this has ever happened...

Populate API Manager “Documentation and Attachments” tab from Swagger 2.0 definition?

How do I specify items for the "Documentation and Attachments" tab in the API Manager in my Swagger 2.0 definition? ...

Can I override properties of a parameter definition object when referencing it?

I have some parameter defined in the root parameters parameters: fooParam: name: foo in: query description: Foo foo foo. required: false type: number format: int32 Now I reference it in a path /pathOne: get: parameters: - $ref: "#/parameters/fooParam" Let say I want to use that parameter in another path or...

returning reference to private vs public member

I would like to know what could be reasons to provide a public access method returning a reference instead of making the member public. QPoint has methods int& rxand int& ry that let me directly manipulate the coordinates. I guess the implentation looks similar to this: public: int& rx(){return x;}...

Watching a variable in python?

In C++, I could imagine constructing with a reference to a counter ( see below ), and then a function would just dereference the address to get a value. Is something similar possible in python? Something like: import time class Count_Watcher: def __init__( self, to_watch ): self.to_watch = to_watch sleep_watch()...

Chain linked classes

I have created long chains of classes, with each link(class) knowing only the next and previous link. I see great advantage over Arrays when the index is not important. public class ChainLink { public ChainLink previousLink, nextLink; // Accessors here } Questions : What is this technique actually called? (I...

Automatically import REST APIs from GitHub / via API into API Manager?

Does the API Manager / Bluemix provide an interface (API, hook) to automatically update API definitions when I push Swagger 2.0 API definition changes to a GitHub repository?

Return type of list front (C++)

So I want to use a list for a part of my program. I'm trying to get acquainted to the library list, so I wrote a quick little program to help myself understand what's going on. It all works properly, but there's one thing I don't understand. According to this:...

reference data class member visitor pattern

I have a container class that has a plain old datatype called DataStore. This data store will be passed to visitor.They share a single copy since any updated performed by the container are to be seen by visitor. class xyz { //Plain Old Datatype typedef struct DataStore { //add any...

Why can a raw type reference refer to a generic instance? [duplicate]

This question already has an answer here: Is List<Dog> a subclass of List<Animal>? Why aren't Java's generics implicitly polymorphic? 8 answers Please help understand why Map map1 = new HashMap<String,String>(); // This compiles Map<Object,Object> map2 = new HashMap<String,String>(); // This does not. As per my understanding Map map1 is...

How can I tell PHPStorm to find references to rewritten URLS?

I wanted to rename one of my files, mypage.php into myprofile.php, but PHPStorm does not find any file references. In the code, mypage.php is referenced without the file extension. For example: <a href='../user/mypage/'> So it has to look for mypage, not mypage.php and rename it myprofile, without file extension. How...

How do I define possible return values with

I have an API call whose response includes a status field with a large number of potential status codes. These codes are numeric and thus not self-explanatory. Using how can I provide a table of these status codes with their corresponding description?...

References - Why do the following two programs produce different output?

I recently read about references in C++. I am aware of basic properties of references but I am still not able to figure out why following two programs produce different output. #include<iostream> using namespace std; int &fun() { static int x = 10; return x; } int main() { fun()...

(Dangling?) Reference returned from function does not “work”

I followed V. Romeo's Tutorial on entity management (on GitHub & Youtube). I then tried to rewrite the classes CEntity, CComponent and for testing CPosition(mostly from memory from Romeo's video/code). The problem i encounter is that, in my main i create a CEntity on the stack & add a component....

Parameters to use in a referenced function c++

I am very confused as to what kind of variables I would put into my function here: names. I am doing a practice problem in a C++ book, because I am learning C++ and am on References and pointers right now, and cannot find a solution. Just for background information,...

create a reference to an array in Nim

var b: array[5, int] type ArrRef = ref array[5, int] var c : ArrRef echo repr(c) # nil c = addr b # doesn't compile, says type is Array constructor, expected reference In Nim, how can I pass references to arrays instead of passing by value? See the above code...

Would it be more efficient to pass a variable to a function by reference than to make a function to return a variable?

So this seems like a fairly simple question, but I haven't been able to find an answer to it anywhere online. The reason I'm assuming a function which returns a variable is less efficient than a function which takes a variable and changes it is because I think the first...

Leverage MultipleApiVersions in Swagger with attribute versioning

Is it possible to leverage MultipleApiVersions in Swagger UI / Swashbuckle when using attribute routing? Specifically, I implemented versioning by: using System.Web.Http; namespace RESTServices.Controllers.v1 { [Route("api/v1/Test")] public class TestV1Controller : ApiController { ... } Version 2 would be in a v2 namespace. In a controller named TestV2Controller. The route would...

Every include should refer to other instance

I include a part of the XHTML page to my Web Application. This part can be included multiple times. And that's the problem! Because every include refers to the same java object. That means that every element has the same value. But I want for each include a new Java...

Using a stored integer as a cell reference

Dim x As Integer Dim y As Integer For y = 3 To 3 For x = 600 To 1 Step -1 If Cells(x, y).Value = "CD COUNT" Then Cells(x, y).EntireRow.Select Selection.EntireRow.Hidden = True End if If Cells(x, y).Value = "CD Sector Average" Then Cells(x, y).EntireRow.Select Selection.Insert Shift:=xlDown Cells(x +...

Passing const references to functions

I was watching a video and saw this code: class Dog { public: Dog() : age(3), name("dummy") {} void setAge(const int &a) { age = a; } private: int age; std::string name; }; I was curious about the function signature for setAge because I've never used const as a function...

Wrong Theme being applied to PreferenceActivity with xml reference

I seem to have a problem implementing a theme onto a PreferenceActivity when i am using an XML reference to refer to said theme. I have 3 style.xml´s style.xml style.xml (v16) style.xml (v21) each of these in its appropriate values directory. To apply the theme, i reference it in my...

Int& to const int -static vs dynamic-

class A { public: A(int i = 25) {x = i;y=new int[i];for(int j=0;j<i;j++) y[j]=j;} int& f() const {return x;} int& operator[](int i) const {return y[i];} private: int x,*y; }; int main() { A a(15); cout << a[5]; cout << a.f(); return 0; } When I'm trying to compile the code...