Ask a Question

x-jvm-type doesn't work with array

sjauhari
Regular Visitor

x-jvm-type doesn't work with array

 

name: users
type: array
items:
x-jvm-type: User

This code generates List of String instead of User. Curious to know if array doesnt work with x-jvm. 

 

Using swagger 2.0

1 REPLY 1
stambaughsonwal
New Member

In Swagger 2.0, the items keyword is used for arrays, but the x-jvm-type extension is not a standard Swagger property. If you want to define the type of items in the array, you can use the items keyword directly with the $ref property.

Example:

yamlCopy code
name: users type: array items: $ref: '#/definitions/User'

This assumes that you have a "definitions" section where the "User" type is defined. Adjust the $ref accordingly based on your Swagger definition structure.

cancel
Showing results for 
Search instead for 
Did you mean: