Skip to content

Generate resource looking for entire path definition #336

@mcruzdev

Description

@mcruzdev

Created from quarkiverse/quarkus-openapi-generator#876 (reply in thread) discussion.

Having the followin OpenAPI:

issue.json
  {
    "openapi": "3.0.3",
    "info": {
      "title": "Example API",
      "version": "1.0.0"
    },
    "paths": {
      "/v1/inventory": {
        "get": {
          "tags": ["InventoriesResource"],
          "summary": "Retrieve inventories",
          "responses": {
            "200": {
              "description": "A list of inventories",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "inv-123"
                        },
                        "name": {
                          "type": "string",
                          "example": "Main warehouse"
                        },
                        "quantity": {
                          "type": "integer",
                          "example": 100
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "/v1/permissions/inventories": {
        "get": {
          "tags": ["PermissionsResource"],
          "summary": "Retrieve permissions",
          "responses": {
            "200": {
              "description": "A list of inventory permissions",
              "content": {
                "application/json": {
                  "schema": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "userId": {
                          "type": "string",
                          "example": "user-456"
                        },
                        "inventoryId": {
                          "type": "string",
                          "example": "inv-123"
                        },
                        "permission": {
                          "type": "string",
                          "example": "READ"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }

The apicurio-codegen looks the first part of the path /v1 and create a resource called V1Resource instead creating V1PermissionsInventories.

I think it would be great if the apicurio-codegen generates per path and not per path prefix.

cc: @EricWittmann

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions