Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generation of custom properties with lists and objects #70

Open
ir0nPotato opened this issue Dec 13, 2024 · 0 comments
Open

Generation of custom properties with lists and objects #70

ir0nPotato opened this issue Dec 13, 2024 · 0 comments

Comments

@ir0nPotato
Copy link

ir0nPotato commented Dec 13, 2024

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant