autocompletion problem for adding mutiple parameters

2016-09-08 Thread Shima
I'm using swagger editor, with auto-completion enabled. 
I want to add "parameters" for an operation, so I choose "parameters" 
keyword, under that I get the "parameter" snippet which gives me the 
snippet for one parameter. Now I want to add another parameter. But the 
autocompletion does not suggest the "parameter" snippet for the second 
parameter. I checked the code, it does not recognize the path correctly. I 
have snapshots attached. 

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: swagger-jersey-jaxrs genereates duplicate operationIds when using inheritance

2016-09-08 Thread alex . rhomberg
Here's a simple demo:

public abstract class BaseClass {
 /**
  * Get some strings
  */
 @GET
 public List getStrings()  {
 return Arrays.asList("somestring", "someotherstring");
 }
}

@Api
@Path("/subclass1")
public class SubClass1 extends BaseClass {}

@Api
@Path("/subclass2")
public class SubClass2 extends BaseClass {}

For these classes, swagger-jersey-jaxrs generates the operationId 
"getStrings" twice, resulting in a "duplicate operationId" error when I 
load the swagger.json into editor.swagger.io

Compare with Enunciate which generates unique operationIds "resource_
SubClass1_getStrings_GET" and "resource_SubClass2_getStrings_GET"

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [swagger2.0] How to represent an array of objects

2016-09-08 Thread Duggie
> You mean the “included” JSON you are showing is a payload sent back to 
the caller?

Yes.

I can work with a common model. Thanks for this help.

Duggie

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [swagger2.0] How to represent an array of objects

2016-09-08 Thread tony tam
You mean the “included” JSON you are showing is a payload sent back to the 
caller?

JSON References are stand-alone—they cannot have siblings.  So you’ll have to 
do something a bit different.

* Define a model as the intersection of the two objects, People and Comments.  
The shared components seem to be “type” and “id”
* Define your response to be an Array of that common model
* Extend the common model for People and Comments using the allOf construct, 
optionally use a discriminator to define how you know which object is a 
“People” and which is a “Comment”.

The other approach is to define a single object and add the “attributes” as a 
map, like such:

attributes:
  type: object
  additionalProperties: true



> On Sep 8, 2016, at 8:18 AM, Duggie  wrote:
> 
> Hi there,
> 
> I want to represent an openapi-spec API in the Swagger editor. I'm struggling 
> to represent the "included" array in a compound document.
> 
> So, let's say I want to define the following JSON snippet in YAML:
> 
> ```json
> "included": [
>   {
> "type": "people",
> "id": "9",
> "attributes": {
>   "first-name": "Dan",
>   "last-name": "Gebhardt",
>   "twitter": "dgeb"
> },
> "links": {
>   "self": "http://example.com/people/9";
> }
>   }, {
> "type": "comments",
> "id": "5",
> "attributes": {
>   "body": "First!"
> }
>   }
> ]
> ``` 
> 
> I can define the first object (people) OK, but I don't know how to define the 
> "comments" object.
> 
> I have tried defining them separately and then listing them but it errors out 
> when I add more than one definition to `items` i.e.
> 
> ```yaml
> included:
>   type: array
>   items:
> $ref: '#/definitions/people'
> $ref: '#/definitions/comments'
> ```
> 
> If I just have the "people" definition, it's fine.
> 
> So, how should I represent an array of different objects?
> 
> Thanks,
> 
> Duggie
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Swagger" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to swagger-swaggersocket+unsubscr...@googlegroups.com 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[swagger2.0] How to represent an array of objects

2016-09-08 Thread Duggie
Hi there,

I want to represent an openapi-spec API in the Swagger editor. I'm 
struggling to represent the "included" array in a compound document.

So, let's say I want to define the following JSON snippet in YAML:

```json
"included": [
{ "type": "people", "id": "9", "attributes": { "first-name": "Dan", "
last-name": "Gebhardt", "twitter": "dgeb" }, "links": { "self": 
"http://example.com/people/9"; } }, { "type": "comments", "id": "5", "
attributes": { "body": "First!" } }
]
``` 

I can define the first object (people) OK, but I don't know how to define 
the "comments" object.

I have tried defining them separately and then listing them but it errors 
out when I add more than one definition to `items` i.e.

```yaml
included:
  type: array
  items:
$ref: '#/definitions/people'
$ref: '#/definitions/comments'
```

If I just have the "people" definition, it's fine.

So, how should I represent an array of different objects?

Thanks,

Duggie

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.