Forum Discussion

sjauhari's avatar
sjauhari
Regular Visitor
9 months ago

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

  • 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.