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

bug: readonly fields missing from mutation function input types #1236

Closed
ezequiel opened this issue Feb 25, 2024 · 0 comments · Fixed by #1237
Closed

bug: readonly fields missing from mutation function input types #1236

ezequiel opened this issue Feb 25, 2024 · 0 comments · Fixed by #1237
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ezequiel
Copy link
Contributor

What are the steps to reproduce this issue?

Minimal swagger.json

{
  "swagger": "2.0",
  "info": {
    "title": "My API",
    "version": "1.0"
  },
  "paths": {
    "/thing/update": {
      "post": {
        "operationId": "UpdateThing",
        "parameters": [
          {
            "name": "models.Thing",
            "in": "body",
            "required": true,
            "schema": {
              "type": "object",
              "$ref": "#/definitions/models.Thing"
            }
          }
        ],
        "responses": {
          "200": {
            "description": ""
          }
        }
      }
    }
  },
  "definitions": {
    "models.ThingDescription": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string"
        }
      }
    },
    "models.Thing": {
      "type": "object",
      "properties": {
        "ThingDescriptions": {
          "type": "array",
          "items": {
            "$ref": "#/definitions/models.ThingDescription"
          },
          "readOnly": true
        }
      }
    }
  }
}

What happens?

When calling the generated updateThing() function, the input body (modelsThing) is empty:

Screenshot 2024-02-25 at 2 58 28 AM

It looks like NonReadonly<T> is producing the incorrect type, thus breaking the types here

What were you expecting to happen?

modelsThing should have the correct type, not {}

What versions are you using?

Package Version: 6.25.0

ezequiel added a commit to ezequiel/orval that referenced this issue Feb 25, 2024
@melloware melloware added the bug Something isn't working label Feb 25, 2024
@melloware melloware added this to the 6.26.0 milestone Feb 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants