Skip to content

Incorrect path generated #66

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

Open
FranDepascuali opened this issue Mar 29, 2025 · 0 comments
Open

Incorrect path generated #66

FranDepascuali opened this issue Mar 29, 2025 · 0 comments
Assignees

Comments

@FranDepascuali
Copy link

Describe the bug
When I generate the openapi spec, it doesn't resolve imports correctly
Check the schemas.

With this:

import SubscriptionTiers from '@kamara/backend/src/database/__tables__/public/SubscriptionTiers.js';
...
export type SubscriptionsApiSpec = Tspec.DefineApiSpec<{
  tags: ['Subscriptions'];
  paths: {
    '/subscriptions': {
      get: {
        summary: 'Get all subscription tiers';
        response: {
          200: SubscriptionTiers;
        };
        // handler: typeof SubscriptionsController.getAllSubscriptionTiers;
      };
    };
  };
}>;

Generated openapi

{
  "info": {
    "title": "Tspec API",
    "version": "0.0.1",
    "description": ""
  },
  "openapi": "3.0.3",
  "paths": {
    "/subscriptions": {
      "get": {
        "operationId": "SubscriptionsApiSpec_get_/subscriptions",
        "tags": [
          "Subscriptions"
        ],
        "summary": "Get all subscription tiers",
        "parameters": [],
        "responses": {}
      }
    }
  },
  "components": {
    "schemas": {
      "import__apps_backend_src_database___tables___public_SubscriptionTiers___assert___resolution-mode___import____.default": {
        "description": "Represents the table public.subscription_tiers",
        "type": "object",
        "properties": {
          "id": {
            "$ref": "#/components/schemas/import__apps_backend_src_database___tables___public_SubscriptionTiers___assert___resolution-mode___import____.SubscriptionTiersId"
          },
          "subscription_type": {
            "type": "string"
          },
          "monthly_price": {
            "type": "string"
          },
          "repository_limit": {
            "type": "number"
          },
          "monthly_credits": {
            "type": "number"
          },
          "created_at": {
            "type": "string",
            "nullable": true
          },
          "updated_at": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "required": [
          "created_at",
          "id",
          "monthly_credits",
          "monthly_price",
          "repository_limit",
          "subscription_type",
          "updated_at"
        ]
      },
      "import__apps_backend_src_database___tables___public_SubscriptionTiers___assert___resolution-mode___import____.SubscriptionTiersId": {
        "description": "Identifier type for public.subscription_tiers",
        "additionalProperties": false,
        "type": "object",
        "properties": {
          "__brand": {
            "type": "string",
            "enum": [
              "SubscriptionTiersId"
            ]
          }
        },
        "required": [
          "__brand"
        ]
      }
    }
  }
}
@hyeonss0417 hyeonss0417 self-assigned this Apr 30, 2025
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

2 participants