Skip to content

Generation of custom properties with lists and objects #70

Open
@ir0nPotato

Description

@ir0nPotato

Hi!

It's not an issue at all, I just want to ask if this feature exists. I'm trying to generate a custom property in the openapi file just as follows:

/hello:
    get:
      tags:
      - HelloApi
      description: Hello method
      operationId: helloWorld
      responses:
        "404":
          description: Not Found
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ErrorResourceResponse'
        "200":
          description: OK
          content:
            '*/*':
              schema:
                type: string
      x-security:
        control:
           type: "X"
        operations:
           - AB12345678
           - AB34567890 

The thing is that, in this custom property 'x-security', I'm not being able to have subproperties that are lists or other objects, remaining as strings as shown below:

      x-security:
        control: "{\"type\": \"X\"}"
        operations: "AB12345678,AB34567890"

The code in Java that I've implemented is the next one:

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.extensions.Extension;
import io.swagger.v3.oas.annotations.extensions.ExtensionProperty;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;

@Tag(name = "HelloApi", description = "API ")
public interface HelloApi {
  @Operation(
    description = "Hello method to test api swagger generator",
    extensions = {
      @Extension(name = "x-security", properties = {
        @ExtensionProperty(name = "operations", value = "AB12345678,AB34567890"),
        @ExtensionProperty(name = "control", value = "{\"type\": \"X\"}")
      })
    }
  )
  @GetMapping("/hello")
  ResponseEntity<String> helloWorld();
}

Do you know if there is a way using this library to generate custom properties having children properties as lists or objects?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

        Participants

        @ir0nPotato

        Issue actions

          Generation of custom properties with lists and objects · Issue #70 · springdoc/springdoc-openapi-maven-plugin