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

Getting invalid reference error for client/service generation #6698

Open
TharmiganK opened this issue Jul 5, 2024 · 2 comments
Open

Getting invalid reference error for client/service generation #6698

TharmiganK opened this issue Jul 5, 2024 · 2 comments

Comments

@TharmiganK
Copy link
Contributor

Description:

Getting the following error when try to generate client/service from a valid OpenAPI specification:

ERROR: Invalid reference found null in the schema.

But the client generation happens with default json type.

Steps to reproduce:

Try to generate client/service for this OpenAPI specification:

openapi: 3.0.1
info:
  title: SocialMedia
  version: 0.1.0
servers:
  - url: "http://{server}:{port}/socialMedia/v1"
    variables:
      server:
        default: localhost
      port:
        default: "8080"
paths:
  /admin.user:
    get:
      summary: Get admin user
      operationId: getAdminUser
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                title: admin.user schema
                type: object
                required:
                  - email
                  - id
                  - name
                properties:
                  id:
                    type: integer
                    format: int64
                  name:
                    type: string
                  email:
                    type: string

Affected Versions:

Ballerina SwanLake Update 9 (2201.9.x)

Note: Identified during the connector generation process for slack: ballerina-platform/module-ballerinax-slack#159 (comment)

@TharmiganK TharmiganK changed the title Getting invalid reference error when client/service generation Getting invalid reference error for client/service generation Jul 5, 2024
@TharmiganK
Copy link
Contributor Author

This issue occurs at the parser level when it does the flattening. The parsed reference look like this:

"$ref" : "admin.user schema"

It should points to a path like this: #/components/schemas/admin.user schema

@TharmiganK
Copy link
Contributor Author

Created an issue in the parser side: swagger-api/swagger-parser#2109

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

No branches or pull requests

1 participant