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

fix. Default string values now with "quotes" #1

Merged
merged 3 commits into from
Apr 9, 2023

Conversation

saatsazov
Copy link

I've added quotes for a default value code. I'm not sure I'm doing this properly but it works for me.

Original problem:
Screenshot 2023-03-09 104838

So I added a quotes to toDefaultValue and use {{{ 3 curly braces so it's not escaped like here:
Screenshot 2023-03-09 105638

My schema:

{
 "openapi": "3.0.3",
 "info": {
  "title": "Basic Example",
  "description": "This app showcases a trivial REST API.",
  "version": "v1.2.3"
 },
 "paths": {
  "/hello/{name}": {
   "get": {
    "tags": [
     "Communication"
    ],
    "summary": "Greeter",
    "description": "Greeter greets you.",
    "operationId": "Greeter",
    "parameters": [
     {
      "name": "age",
      "in": "query",
      "schema": {
       "type": "integer",
       "default": 5
      }
     },
     {
      "name": "locale",
      "in": "query",
      "schema": {
       "pattern": "^[a-z]{2}-[A-Z]{2}$",
       "enum": [
        "ru-RU",
        "en-US"
       ],
       "type": "string",
       "default": "en-US"
      }
     },
     {
      "name": "name",
      "in": "path",
      "required": true,
      "schema": {
       "minLength": 3,
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "OK",
      "headers": {
       "X-Now": {
        "style": "simple",
        "schema": {
         "type": "string",
         "format": "date-time"
        }
       }
      },
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/HelloOutput"
        }
       }
      }
     },
     "400": {
      "description": "Bad Request",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/RestErrResponse"
        }
       }
      }
     }
    }
   }
  }
 },
 "components": {
  "schemas": {
   "HelloOutput": {
    "type": "object",
    "properties": {
     "message": {
      "type": "string"
     }
    }
   },
   "RestErrResponse": {
    "type": "object",
    "properties": {
     "code": {
      "type": "integer",
      "description": "Application-specific error code."
     },
     "context": {
      "type": "object",
      "additionalProperties": {},
      "description": "Application context."
     },
     "error": {
      "type": "string",
      "description": "Error message."
     },
     "status": {
      "type": "string",
      "description": "Status text."
     }
    }
   }
  }
 }
}

Copy link
Owner

@Goutte Goutte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks !

@Goutte Goutte merged commit 13d3c5c into Goutte:feat-gdscript Apr 9, 2023
saatsazov pushed a commit to saatsazov/openapi-generator that referenced this pull request Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants