8000 Modifying via overlay fails if an array item contains a field that starts with a newline · Issue #2171 · oapi-codegen/oapi-codegen · GitHub
[go: up one dir, main page]

Skip to content

Modifying via overlay fails if an array item contains a field that starts with a newline #2171

@wndhydrnt

Description

@wndhydrnt

How to reproduce:

Create the following files in a directory.

openapi.yaml
# openapi.yaml
openapi: "3.0.0"
info:
  version: 1.0.0
  title: Generate models
paths:
  /client:
    get:
      operationId: getClient
      parameters:
        - description: "\nThis line causes the issue\n"
          name: example
          in: query
          schema:
            type: string
      responses:
        200:
          description: "This is fine"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ClientType"
components:
  schemas:
    ClientType:
      type: object
      required:
        - name
      properties:
        name:
          type: string
oapi-codegen.yaml
# oapi-codegen.yaml
package: client
output: openapi.gen.go
generate:
  models: true
  client: true
output-options:
  overlay:
    path: overlay.yaml
overlay.yaml
# overlay.yaml
overlay: 1.0.0

info:
  title: Overlay
  version: 0.0.0

actions:
  - target: "$"
    update:
      info:
        x-overlay-applied: structured-overlay

Execute oapi-codegen:

oapi-codegen -config oapi-codegen.yaml openapi.yaml

Result:

error loading swagger spec in openapi.yaml
: failed to parse spec from "openapi.yaml": yaml: line 18: did not find expected key
exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0