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

Valid input throws #44

Closed
adamp01 opened this issue Dec 7, 2022 · 1 comment
Closed

Valid input throws #44

adamp01 opened this issue Dec 7, 2022 · 1 comment

Comments

@adamp01
Copy link

adamp01 commented Dec 7, 2022

Hi,

I am using the CLI installed via homebrew speakeasy version 0.15.7.

I have a pre-validated OpenAPI spec that throws without an overly useful error message. In the full spec (~200 paths) this appears to be the only issue that speakeasy has. It throws as part of the full spec and in the below reduced spec. The error occurs with both a yml and json input.

Command: speakeasy generate sdk -s ns_openapi.json -l python -o .

Spec:

{
    "openapi": "3.0.3",
    "info": {
      "title": "NS Platform Public",
      "version": "1.0.0",
      "contact": {}
    },
    "servers": [
      {
        "url": "https://platform.neuralspace.ai"
      },
      {
        "url": "http://localhost"
      }
    ],
    "paths": {
      "/api/ner/v1/project": {
        "get": {
          "tags": [
            "Named Entity Recognition (NER)",
            "Project1"
          ],
          "summary": "Get single project",
          "description": "Get single project",
          "operationId": "getSingleProject1",
          "parameters": [
            {
              "name": "projectId",
              "in": "query",
              "schema": {
                "type": "string",
                "example": "43952a27-be05-4b7b-b4ad-f9df616bbca1"
              }
            },
            {
              "name": "language",
              "in": "query",
              "schema": {
                "type": "string",
                "example": "hi"
              }
            },
            {
              "name": "",
              "in": "query",
              "schema": {
                "type": "string",
                "example": ""
              }
            }
          ],
          "responses": {
            "200": {
              "description": ""
            }
          }
        },
        "put": {
          "tags": [
            "Named Entity Recognition (NER)",
            "Project1"
          ],
          "summary": "Update project",
          "description": "Update project",
          "operationId": "updateProject1",
          "requestBody": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "noOfTrainingJob": {
                      "type": "number",
                      "example": 3
                    },
                    "projectId": {
                      "type": "string",
                      "example": "43952a27-be05-4b7b-b4ad-f9df616bbca1"
                    },
                    "projectName": {
                      "type": "string",
                      "example": "Hindi Project"
                    }
                  }
                },
                "example": {
                  "noOfTrainingJob": 3,
                  "projectId": "43952a27-be05-4b7b-b4ad-f9df616bbca1",
                  "projectName": "Hindi Project"
                }
              }
            }
          },
          "responses": {
            "200": {
              "description": ""
            }
          }
        },
        "post": {
          "tags": [
            "Named Entity Recognition (NER)",
            "Project1"
          ],
          "summary": "Create project",
          "description": "Create project",
          "operationId": "createProject1",
          "requestBody": {
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "language": {
                      "type": "array",
                      "items": {
                        "type": "string",
                        "example": "hi"
                      },
                      "example": [
                        "hi"
                      ]
                    },
                    "projectName": {
                      "type": "string",
                      "example": "My first project"
                    }
                  }
                },
                "example": {
                  "language": [
                    "hi"
                  ],
                  "projectName": "My first project"
                }
              }
            }
          },
          "responses": {
            "200": {
              "description": ""
            }
          }
        }
      }
    }
  }

Error:

Error: failed to validate schema: invalid paths: invalid path /api/ner/v1/project: invalid operation GET: parameter name can't be blank: invalid path /api/ner/v1/project: invalid operation GET: parameter name can't be blank
failed to validate schema: invalid paths: invalid path /api/ner/v1/project: invalid operation GET: parameter name can't be blank: invalid path /api/ner/v1/project: invalid operation GET: parameter name can't be blank
@adamp01
Copy link
Author

adamp01 commented Dec 7, 2022

Found the error here, there was a param that online validators seem to miss:

            {
              "name": "",
              "in": "query",
              "schema": {
                "type": "string",
                "example": ""
              }

@adamp01 adamp01 closed this as completed Dec 7, 2022
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