x-jvm-type doesn't work with array
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023
04:07 PM
11-06-2023
04:07 PM
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
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-15-2023
10:53 AM
11-15-2023
10:53 AM
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.
