swagger-core icon indicating copy to clipboard operation
swagger-core copied to clipboard

Generating dictionaries for free-form objects with Gradle plugin?

Open joe-akeem opened this issue 1 year ago • 0 comments

According to the documentation for dictionaries, they can contain free-form objects which are specified in one of the following forms:

type: object
"additionalProperties": {} 
type: object
"additionalProperties": true

How would I annotate the following Java code so the Gradle resolve task generates an OpenApi dictionary in the form above?

public class CreateRequest {
    private Map<String, Object> contextData;
}

Without any annotation I end up with the following specification:

"additionalProperties": {
    "type": "object",
    "nullable": true
  }

This isn't quite the same as this dictionary couldn't hold strings, for example (a "string" is not an "object" in OpenApi).

joe-akeem avatar Jul 04 '24 11:07 joe-akeem