Skip to content

PropertyResolverUtils.resolveExtensions converts ObjectNode instances to strings #3234

@marr1977

Description

@marr1977

Describe the bug

PropertyResolverUtils.resolveExtensions will convert ObjectNode instances to Strings in cases where the extension value is a HashMap

If value1, i.e. the hashmap value, is an ObjectNode, it will be converted to a String by the line below:

String value1Resolved = this.resolve(value1.toString(), locale);

A possible solution is to only call "resolve" if "value1 instanceof String", as is done for non-hashmap extension values.

To Reproduce

  • What modules and versions of springdoc-openapi are you using? 3.0.1

We have extension properties as part/children of extension-values where the extension property is a json-object, example below:

  @Extension(
                                 name = "x-my-extension",
                                 properties = {
                         		   @ExtensionProperty(
                                                  name = "working-hours",
                                                  parseValue = true,
                                                  value = "{  \"working-hours\": \"Weekdays 00:15 - 22:59 CET\" }"
                                         ),

The output of this is the following

"x-my-extension": {
  "working-hours": "{\"working-hours\":\"Weekdays 00:15 - 22:59 CET\"}",

I.e. the value is a string and not a JSON object.

Expected behavior

I expect the result to be a JSON object, like below:

"x-my-extension": {
  "working-hours": { "working-hours": "Weekdays 00:15 - 22:59 CET" },

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions