Coder Social home page Coder Social logo

ogen-go / ogen Goto Github PK

View Code? Open in Web Editor NEW
1.1K 16.0 67.0 60.48 MB

OpenAPI v3 code generator for go

Home Page: https://ogen.dev

License: Apache License 2.0

Go 99.89% Makefile 0.07% Shell 0.02% Dockerfile 0.02%
go golang openapi swagger api codegen openapi3 code-generator openapi-codegen openapi-generator

ogen's Introduction

ogen svg logo

ogen Go Reference codecov stable

OpenAPI v3 Code Generator for Go.

Install

go get -d github.com/ogen-go/ogen

Usage

//go:generate go run github.com/ogen-go/ogen/cmd/ogen --target target/dir -package api --clean schema.json

or using container:

docker run --rm \
  --volume ".:/workspace" \
  ghcr.io/ogen-go/ogen:latest --target workspace/petstore --clean workspace/petstore.yml

Features

  • No reflection or interface{}
    • The json encoding is code-generated, optimized and uses go-faster/jx for speed and overcoming encoding/json limitations
    • Validation is code-generated according to spec
  • Code-generated static radix router
  • No more boilerplate
    • Structures are generated from OpenAPI v3 specification
    • Arguments, headers, url queries are parsed according to specification into structures
    • String formats like uuid, date, date-time, uri are represented by go types directly
  • Statically typed client and server
  • Convenient support for optional, nullable and optional nullable fields
    • No more pointers
    • Generated Optional[T], Nullable[T] or OptionalNullable[T] wrappers with helpers
    • Special case for array handling with nil semantics relevant to specification
      • When array is optional, nil denotes absence of value
      • When nullable, nil denotes that value is nil
      • When required, nil currently the same as [], but is actually invalid
      • If both nullable and required, wrapper will be generated (TODO)
  • Generated sum types for oneOf
    • Primitive types (string, number) are detected by type
    • Discriminator field is used if defined in schema
    • Type is inferred by unique fields if possible
  • Extra Go struct field tags in the generated types
  • OpenTelemetry tracing and metrics

Example generated structure from schema:

// Pet describes #/components/schemas/Pet.
type Pet struct {
	Birthday     time.Time     `json:"birthday"`
	Friends      []Pet         `json:"friends"`
	ID           int64         `json:"id"`
	IP           net.IP        `json:"ip"`
	IPV4         net.IP        `json:"ip_v4"`
	IPV6         net.IP        `json:"ip_v6"`
	Kind         PetKind       `json:"kind"`
	Name         string        `json:"name"`
	Next         OptData       `json:"next"`
	Nickname     NilString     `json:"nickname"`
	NullStr      OptNilString  `json:"nullStr"`
	Rate         time.Duration `json:"rate"`
	Tag          OptUUID       `json:"tag"`
	TestArray1   [][]string    `json:"testArray1"`
	TestDate     OptTime       `json:"testDate"`
	TestDateTime OptTime       `json:"testDateTime"`
	TestDuration OptDuration   `json:"testDuration"`
	TestFloat1   OptFloat64    `json:"testFloat1"`
	TestInteger1 OptInt        `json:"testInteger1"`
	TestTime     OptTime       `json:"testTime"`
	Type         OptPetType    `json:"type"`
	URI          url.URL       `json:"uri"`
	UniqueID     uuid.UUID     `json:"unique_id"`
}

Example generated server interface:

// Server handles operations described by OpenAPI v3 specification.
type Server interface {
	PetGetByName(ctx context.Context, params PetGetByNameParams) (Pet, error)
	// ...
}

Example generated client method signature:

type PetGetByNameParams struct {
    Name string
}

// GET /pet/{name}
func (c *Client) PetGetByName(ctx context.Context, params PetGetByNameParams) (res Pet, err error)

Generics

Instead of using pointers, ogen generates generic wrappers.

For example, OptNilString is string that is optional (no value) and can be null.

// OptNilString is optional nullable string.
type OptNilString struct {
	Value string
	Set   bool
	Null  bool
}

Multiple convenience helper methods and functions are generated, some of them:

func (OptNilString) Get() (v string, ok bool)
func (OptNilString) IsNull() bool
func (OptNilString) IsSet() bool

func NewOptNilString(v string) OptNilString

Recursive types

If ogen encounters recursive types that can't be expressed in go, pointers are used as fallback.

Sum types

For oneOf sum-types are generated. ID that is one of [string, integer] will be represented like that:

type ID struct {
	Type   IDType
	String string
	Int    int
}

// Also, some helpers:
func NewStringID(v string) ID
func NewIntID(v int) ID

Extension properties

OpenAPI enables Specification Extensions, which are implemented as patterned fields that are always prefixed by x-.

Server name

Optionally, server name can be specified by x-ogen-server-name, for example:

{
  "openapi": "3.0.3",
  "servers": [
    {
      "x-ogen-server-name": "production",
      "url": "https://{region}.example.com/{val}/v1",
    },
    {
      "x-ogen-server-name": "prefix",
      "url": "/{val}/v1",
    },
    {
      "x-ogen-server-name": "const",
      "url": "https://cdn.example.com/v1"
    }
  ],
(...)

Custom type name

Optionally, type name can be specified by x-ogen-name, for example:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "x-ogen-name": "Name",
  "properties": {
    "foobar": {
      "$ref": "#/$defs/FooBar"
    }
  },
  "$defs": {
    "FooBar": {
      "x-ogen-name": "FooBar",
      "type": "object",
      "properties": {
        "foo": {
          "type": "string"
        }
      }
    }
  }
}

Custom field name

Optionally, type name can be specified by x-ogen-properties, for example:

components:
  schemas:
    Node:
      type: object
      properties:
        parent:
          $ref: "#/components/schemas/Node"
        child:
          $ref: "#/components/schemas/Node"
      x-ogen-properties:
        parent:
          name: "Prev"
        child:
          name: "Next"

The generated source code looks like:

// Ref: #/components/schemas/Node
type Node struct {
    Prev *Node `json:"parent"`
    Next *Node `json:"child"`
}

Extra struct field tags

Optionally, additional Go struct field tags can be specified by x-oapi-codegen-extra-tags, for example:

components:
  schemas:
    Pet:
      type: object
      required:
        - id
      properties:
        id:
          type: integer
          format: int64
          x-oapi-codegen-extra-tags:
            gorm: primaryKey
            valid: customIdValidator

The generated source code looks like:

// Ref: #/components/schemas/Pet
type Pet struct {
    ID   int64     `gorm:"primaryKey" valid:"customNameValidator" json:"id"`
}

Streaming JSON encoding

By default, ogen loads the entire JSON body into memory before decoding it. Optionally, streaming JSON encoding can be enabled by x-ogen-json-streaming, for example:

requestBody:
  required: true
  content:
    application/json:
      x-ogen-json-streaming: true
      schema:
        type: array
        items:
          type: number

Operation groups

Optionally, operations can be grouped so a handler interface will be generated for each group of operations. This is useful for organizing operations for large APIs.

The group for operations on a path or individual operations can be specified by x-ogen-operation-group, for example:

paths:
  /images:
    x-ogen-operation-group: Images
    get:
      operationId: listImages
      ...
  /images/{imageID}:
    x-ogen-operation-group: Images
    get:
      operationId: getImageByID
      ...
  /users:
    x-ogen-operation-group: Users
    get:
      operationId: listUsers
      ...

The generated handler interfaces look like this:

// x-ogen-operation-group: Images
type ImagesHandler interface {
    ListImages(ctx context.Context, req *ListImagesRequest) (*ListImagesResponse, error)
    GetImageByID(ctx context.Context, req *GetImagesByIDRequest) (*GetImagesByIDResponse, error)
}

// x-ogen-operation-group: Users
type UsersHandler interface {
    ListUsers(ctx context.Context, req *ListUsersRequest) (*ListUsersResponse, error)
}

type Handler interface {
    ImagesHandler
    UsersHandler
    // All un-grouped operations will be on this interface
}

JSON

Code generation provides very efficient and flexible encoding and decoding of json:

// Decode decodes Error from json.
func (s *Error) Decode(d *jx.Decoder) error {
	if s == nil {
		return errors.New("invalid: unable to decode Error to nil")
	}
	return d.ObjBytes(func(d *jx.Decoder, k []byte) error {
		switch string(k) {
		case "code":
			if err := func() error {
				v, err := d.Int64()
				s.Code = int64(v)
				if err != nil {
					return err
				}
				return nil
			}(); err != nil {
				return errors.Wrap(err, "decode field \"code\"")
			}
		case "message":
			if err := func() error {
				v, err := d.Str()
				s.Message = string(v)
				if err != nil {
					return err
				}
				return nil
			}(); err != nil {
				return errors.Wrap(err, "decode field \"message\"")
			}
		default:
			return d.Skip()
		}
		return nil
	})
}

Links

ogen's People

Contributors

alesbrelih avatar alexandermint avatar avdgl avatar daniel-vetter-coverwhale avatar danilvpetrov avatar dependabot[bot] avatar egor-gorlin-exinity avatar ernado avatar giautm avatar gvencadze avatar iwata avatar jmalloc avatar johnrutherford avatar k4n4ry avatar liooo avatar lukasmalkmus avatar masseelch avatar max107 avatar mpldr avatar natehart avatar pespantelis avatar pgillich avatar sashamelentyev avatar shadowspore avatar taxio avatar tdakkota avatar thmeitz avatar utherbit avatar vallahaye avatar zorinarsenij avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ogen's Issues

Add CI

Add github pipeline for tests and coverage

bug: generator does not follow optional decoding rules described in docs

Schema:

{
   "type":"object",
   "properties":{
      "array":{
         "type":"array",
         "nullable":false,
         "items":{
            "type":"string"
         }
      }
   }
}

Generated type:

type AbcOK struct {
	Array []string `json:"array"`
}

Generated decoder:

// Decode decodes AbcOK from json.
func (s *AbcOK) Decode(d *jx.Decoder) error {
	if s == nil {
		return errors.New("invalid: unable to decode AbcOK to nil")
	}

	if err := d.ObjBytes(func(d *jx.Decoder, k []byte) error {
		switch string(k) {
		case "array":
			if err := func() error {
				s.Array = nil
				if err := d.Arr(func(d *jx.Decoder) error {
					var elem string
					v, err := d.Str()
					elem = string(v)
					if err != nil {
						return err
					}
					s.Array = append(s.Array, elem)
					return nil
				}); err != nil {
					return err
				}
				return nil
			}(); err != nil {
				return errors.Wrap(err, "decode field \"array\"")
			}
		default:
			return d.Skip()
		}
		return nil
	}); err != nil {
		return errors.Wrap(err, "decode AbcOK")
	}

	return nil
}

Decoder does not set non-nil value on empty array input like

{
      "array": []
}

so it is not possible to distinguish [] and no value.

feat(gen): security support

Proposal

  1. Generate handler for each security scheme
  2. Propagate authentication in context

Example:

type TokenSecurity struct {
    Token string // from `auth-token` header
}

type Handler interface {
    HandleTokenSecurity(context.Context, TokenSecurity) (context.Context, error) 
}

extendable behaviour when the route does not exist

Sometimes we need to do some additional manipulations in those cases when the requested route does not exist.

Currently, ogen just calls Server.notFound() at Server.ServeHTTP(), meanwhile chi gives us the possibility to redefine the flow of what happens if the route was not found.

gen: ogen does not generate encoder and decoder for optional arrays

From oas_json_gen.go:

// Encode encodes []string as json.
func (o OptNilStringArray) Encode(e *jx.Writer) {
	if !o.Set {
		return
	}
	if o.Null {
		e.Null()
		return
	}
}

// Decode decodes []string from json.
func (o *OptNilStringArray) Decode(d *jx.Decoder) error {
	if o == nil {
		return errors.New(`invalid: unable to decode OptNilStringArray to nil`)
	}
	switch d.Next() {
	case jx.Array:
		o.Set = true
		o.Null = false
		return nil
	case jx.Null:
		if err := d.Null(); err != nil {
			return err
		}
		var v []string
		o.Value = v
		o.Set = true
		o.Null = true
		return nil
	default:
		return errors.Errorf(`unexpected type %q while reading OptNilStringArray`, d.Next())
	}
}

feat: support unix timestamp formats

Design and implement unix timestamp support for integer/string types.

I propose following formats:

  • unix (same as unix-seconds)
  • unix-seconds
  • unix-nano
  • unix-micro
  • unix-milli

This should generate time.Time field.

For strings, use "string integers" #309 like in OpenTelemetry log format:

{
   "Timestamp": "1586960586000000000",
   "Attributes":{
      "http.scheme":"https",
      "http.host":"donut.mycie.com",
      "http.target":"/order",
      "http.method":"post",
      "http.status_code":500,
      "http.flavor":"1.1",
      "http.user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36",
   }
}

perf(gen): slow examples generation

I was wondering why examples tooks around 9 seconds to generate (at least, on my machine).
Here's investigation results:

  1. Code formatting is slow.
  2. Template execution is sequential, but can be done in parallel.
  3. The go generate directive executes commands sequentially, but they also can be executed in parallel (affects to this case the most).

I did some profiling to measure how much time which generation step takes, and this is the results for github api spec:

format=true

Parsing:    0.07569065 seconds
Generation: 0.11895104 seconds
Writing:    2.01221638 seconds

format=false

Parsing:    0.07272715 seconds
Generation: 0.11632878 seconds
Writing:    0.50160086 seconds

Surprisingly, the code formatting is the slowest part of the whole project.
Writing source code without formatting is x3-x4 times faster.
For the smaller OpenAPI documents the difference is not that dramatic, but anyway... that's annoying.

The best solution is to generate already formatted code.
This completely removes the necessity of code formatting step, and allows to render templates into files directly without buffering.
But it will be tricky to do becase of templates which can call each other recursively N times (we should handle indentation somehow).
This can make these complex templates even more complex.

The next two issues, unlike the previous one, should be easy to fix.

perf(gen): client makes two copy of encoded data

  1. jx.Writer/jx.Encode's buffer
    func encodeFoobarPostRequestJSON(req OptPet, span trace.Span) (data *bytes.Buffer, err error) {
    buf := getBuf()
    e := jx.GetEncoder()
    defer jx.PutEncoder(e)
    if req.Set {
    req.Encode(e)
    }
    if _, err := e.WriteTo(buf); err != nil {
    putBuf(buf)
    return nil, err
    }
    return buf, nil
    }
  2. Returned bytes.Buffer
    buf, err := encodeFoobarPostRequestJSON(request, span)
    if err != nil {
    return res, err
    }
    defer putBuf(buf)
    reqBody = buf

bug(gen): oneOf type detection by unique fields doesn't work properly

Operation to reproduce:

"/oneofBug": {
  "post": {
    "operationId": "oneofBug",
    "requestBody": {
      "required": true,
      "content": {
        "application/json": {
          "schema": {
            "oneOf": [
              {
                "type": "object",
                "required": ["common-1", "common-2", "unique-1"],
                "properties": {
                  "common-1": {"type": "string"},
                  "common-2": {"type": "integer"},
                  "unique-1": {"type": "string"}
                }
              },
              {
                "type": "object",
                "required": ["common-1", "common-2", "unique-2"],
                "properties": {
                  "common-1": {"type": "string"},
                  "common-2": {"type": "integer"},
                  "unique-2": {"type": "string"}
                }
              }
            ]
          }
        }
      }
    },
    "responses": {
      "200": {
        "description": "Ok"
      }
    }
  }
}

ogen generates following code for json decoding:

// Decode decodes OneofBugReq from json.
func (s *OneofBugReq) Decode(d *jx.Decoder) error {
	if s == nil {
		return errors.New(`invalid: unable to decode OneofBugReq to nil`)
	}
	// Sum type fields.
	if d.Next() != jx.Object {
		return errors.Errorf("unexpected json type %q", d.Next())
	}
	var found bool
	if err := d.Capture(func(d *jx.Decoder) error {
		return d.ObjBytes(func(d *jx.Decoder, key []byte) error {
			if found {
				return d.Skip()
			}
			switch string(key) {
			case "unique-1":
				found = true
				s.Type = OneofBugReq0OneofBugReq
			case "common-1":
				found = true
				s.Type = OneofBugReq1OneofBugReq
			case "common-2":
				found = true
				s.Type = OneofBugReq1OneofBugReq
			case "unique-2":
				found = true
				s.Type = OneofBugReq1OneofBugReq
			}
			return d.Skip()
		})
	}); err != nil {
		return errors.Wrap(err, "capture")
	}
	if !found {
		return errors.New("unable to detect sum type variant")
	}
	switch s.Type {
	case OneofBugReq0OneofBugReq:
		if err := s.OneofBugReq0.Decode(d); err != nil {
			return err
		}
	case OneofBugReq1OneofBugReq:
		if err := s.OneofBugReq1.Decode(d); err != nil {
			return err
		}
	default:
		return errors.Errorf("inferred invalid type: %s", s.Type)
	}
	return nil
}

bug(router): root level routes are not handled

If a route like /petshas a subroute like/pets/{id}any request to/pets` results in a 404 response. The generated router does not call the respective handlers in that case:

case "POST":
	// Root edge.
	elem, p = nextElem(p) 
	switch string(elem)  {
	default:
		s.notFound(w, r) // <- should call the POST handler for `/pets`
		return
	}
}
default:

docs: add overview and common cases

  • Add quick start section
  • Describe "Convenient errors" concept
  • Describe request/response types generation and how ogen handles multiple variants
    • Request
    • Responses
  • Describe supported formats and types
    • Optional
    • Map
    • Primitives
    • Sum types
    • Enums
    • Any
  • Describe type discriminator inference algorithm in general
  • Add FAQ/Troubleshooting section
    • Define when and why ogen uses jx.Raw
    • Describe ErrNotImplemented
    • Describe supported content types and io.Reader fallback
  • Add note about ogent

feat: support oneOf of references

openapi: 3.0.3
info:
  title: Loki
  description: Loki HTTP
  version: 1.0.0
servers:
  - url: 'https'
paths:
  /loki/api/v1/query_range:
    get:
      operationId: queryRange
      description: Query range
      parameters:
        - name: start
          in: query
          schema:
            type: integer
            format: int64
        - name: query
          in: query
          schema:
            type: string
        - name: step
          in: query
          schema:
            type: integer
        - name: end
          in: query
          schema:
            type: integer
            format: int64
        - name: direction
          in: query
          schema:
            $ref: "#/components/schemas/Direction"
      responses:
        200:
          description: "Label list"
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/QueryResponseData"
        default:
          $ref: "#/components/responses/Error"
components:
  responses:
    Error:
      description: "Unexpected error"
      content:
        application/json:
          schema:
            type: object
            required:
              - status
            properties:
              status:
                type: string
  schemas:
    Stream:
      type: object
    Streams:
      type: array
      items:
        $ref: "#/components/schemas/Stream"
    Stats:
      type: object
    QueryResponseData:
      type: object
      discriminator:
        propertyName: resultType
        mapping:
          streams: "#/components/schemas/Streams"
      oneOf:
        - $ref: "#/components/schemas/Streams"
      properties:
        stats:
          $ref: "#/components/schemas/Stats"
    Direction:
      type: string
      enum:
        - BACKWARD
        - FORWARD

Error:

  - schema:
    github.com/ogen-go/ogen/gen.(*Generator).generateContents.func1
        /go/pkg/mod/github.com/ogen-go/[email protected]/gen/gen_contents.go:81
  - oneOf:
    github.com/ogen-go/ogen/gen.(*schemaGen).generate
        /go/pkg/mod/github.com/ogen-go/[email protected]/gen/schema_gen.go:101
  - ir.Kind:
    github.com/ogen-go/ogen/gen.(*schemaGen).oneOf
        /go/pkg/mod/github.com/ogen-go/[email protected]/gen/schema_gen_sum.go:154
  - unsupported sum type variant not implemented

bug(gen): discriminator inference by unique fields is incorrect, if sum has one non-object type

Schema:

      "SumType": {
        "oneOf": [
          {
            "type": "object",
            "properties": {
              "unique-1": {
                "type": "string"
              },
              "common": {
                "type": "integer"
              }
            }
          },
          {
            "type": "object",
            "properties": {
              "unique-2": {
                "type": "string"
              },
              "common": {
                "type": "integer"
              }
            }
          },
          {
            "type": "string"
          }
        ]
      }

Generated detection of type:

	// Sum type fields.
	if d.Next() != jx.Object {
		return errors.Errorf("unexpected json type %q", d.Next())
	}

	var found bool
	if err := d.Capture(func(d *jx.Decoder) error {
		return d.ObjBytes(func(d *jx.Decoder, key []byte) error {
			if found {
				return d.Skip()
			}
			switch string(key) {
			case "unique-1":
				found = true
				s.Type = SumType0SumType
			case "unique-2":
				found = true
				s.Type = SumType1SumType
			}
			return d.Skip()
		})
	}); err != nil {
		return errors.Wrap(err, "capture")
	}
	if !found {
		s.Type = StringSumType
	}

It seems it treats string as object without unique fields.

feat: support xml

Looks like encoding/xml is good enough to support all features.

Otherwise we can always fallback to inline encoding for requests and responses.

bug(gen): default values doesn't work in query parameters

"/queryParamEnumDefaultValue": {
  "get": {
    "operationId": "queryParamEnumDefaultValue",
    "parameters": [
      {
        "name": "format",
        "in": "query",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "yaml",
            "json"
          ],
          "default": "yaml"
        }
      }
    ],
    "responses": {
      "200": {
        "description": "ok",
        "content": {
          "application/json": {
            "schema": {
              "type": "string",
              "description": "format value"
            }
          }
        }
      }
    }
  }
}

bug(gen): numeric named references are generating broken Go code

When generating Go types for e.g. a named response like this one:

"400": {
        "description": "invalid input, data invalid",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "integer",
                  "format": "int32"
                },
                "status": {
                  "type": "string"
                },
                "errors": {}
              }
            }
          }
        }
      }

The resulting Go code is the following:

type 400 struct {
	Code OptInt32 `json:"code"`
	Status OptString `json:"status"`
	Errors OptString `json:"errors"`
}

400 is not a valid struct name but it is a valid name in OAS definitions.

I propose to change the code gen behavior to prefix the struct name with 'R' or similar in case of a non allowed char.

bug(gen): convenient errors are not triggered if endpoint has not defautls

{
  "openapi": "3.0.3",
  "paths": {
    "/healthz": {
      "get": {
        "operationId": "probeLiveness",
        "description": "Liveness probe for kubernetes",
        "responses": {
          "200": {
            "description": "User info",
            "content": {
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
[...]

This breaks convenient errors.

bug: implicit mapping does not work

components:
  schemas:
    JobNothing:
      description: Do nothing
      required:
        - type
      properties:
        type:
          type: string
    JobDownload:
      description: Download chunk
      required:
        - type
        - date
      properties:
        type:
          type: string
        date:
          type: string
          format: datetime
    Job:
      description: job to perform on worker
      discriminator:
        propertyName: "type"
      oneOf:
        - $ref: "#/components/schemas/JobNothing"
        - $ref: "#/components/schemas/JobDownload"
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0x683761]

goroutine 1 [running]:
github.com/ogen-go/ogen/internal/gen.(*schemaGen).generate(0xc0002657e8, {0xc000266f90, 0x1000057c6b20a10}, 0xc000186640)
        /go/pkg/mod/github.com/ogen-go/[email protected]/internal/gen/schema_gen.go:205 +0x1c21
github.com/ogen-go/ogen/internal/gen.(*Generator).generateSchema(0xc0000f82c0, {0xc000266f90, 0xd}, 0x10)
        /go/pkg/mod/github.com/ogen-go/[email protected]/internal/gen/gen_schema.go:14 +0x9a
github.com/ogen-go/ogen/internal/gen.(*Generator).responseToIR(0xc0000f82c0, {0xc000266f90, 0xc000265b30}, {0xc000021940, 0x2}, 0xc0002568b8)
        /go/pkg/mod/github.com/ogen-go/[email protected]/internal/gen/gen_responses.go:151 +0x845
github.com/ogen-go/ogen/internal/gen.(*Generator).generateResponses(0xc0000f82c0, {0xc000266eb0, 0xb}, 0xc000272390)
        /go/pkg/mod/github.com/ogen-go/[email protected]/internal/gen/gen_responses.go:34 +0x39b
github.com/ogen-go/ogen/internal/gen.(*Generator).generateOperation(0x0, 0xc0000ae9c0)
        /go/pkg/mod/github.com/ogen-go/[email protected]/internal/gen/gen_operation.go:37 +0x296
github.com/ogen-go/ogen/internal/gen.(*Generator).makeIR(0xc0000f82c0, {0xc000010848, 0x0, 0xc000265da0})
        /go/pkg/mod/github.com/ogen-go/[email protected]/internal/gen/generator.go:78 +0xac
github.com/ogen-go/ogen/internal/gen.NewGenerator(0x0, {{0x0, 0x0}, {0xc000272380, 0x1, 0x1}})
        /go/pkg/mod/github.com/ogen-go/[email protected]/internal/gen/generator.go:58 +0x1f5
main.main()
        /go/pkg/mod/github.com/ogen-go/[email protected]/cmd/ogen/main.go:100 +0x48c
exit status 2
gen.go:3: running "go": exit status 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.