Repository: ogen-go/ogen
Pull request #86 (2021-12-17 20:24:19)

refactor: export `gen` package


Patch:
diff --git a/README.md b/README.md
index e544567e..3f31ac17 100644
--- a/README.md
+++ b/README.md
@@ -168,7 +168,6 @@ func (s *Error) ReadJSON(r *json.Reader) error {
 
 * Security (e.g. Bearer token)
 * Cookie params
-* Default value
 * Tests for `ip` package
 * Support complex parameters in router
   * `/{name}.{format}` or `foo.{bar}`, now only `/{foo}/{bar}/` is supported
diff --git a/cmd/ogen/main.go b/cmd/ogen/main.go
index d1f59a3a..b7490693 100644
--- a/cmd/ogen/main.go
+++ b/cmd/ogen/main.go
@@ -10,7 +10,7 @@ import (
 	"strings"
 
 	"github.com/ogen-go/ogen"
-	"github.com/ogen-go/ogen/internal/gen"
+	"github.com/ogen-go/ogen/gen"
 )
 
 type formattedSource struct {
diff --git a/dsl.go b/dsl.go
index 961801c5..b0d9a3f2 100644
--- a/dsl.go
+++ b/dsl.go
@@ -233,7 +233,7 @@ func (r *RequestBody) SetContent(c map[string]Media) *RequestBody {
 func (r *RequestBody) AddContent(mt string, s *Schema) *RequestBody {
 	if s != nil {
 		r.initContent()
-		r.Content[mt] = Media{Schema: *s}
+		r.Content[mt] = Media{*s}
 	}
 	return r
 }
@@ -713,7 +713,7 @@ func (r *Response) SetContent(c map[string]Media) *Response {
 func (r *Response) AddContent(mt string, s *Schema) *Response {
 	if s != nil {
 		r.initContent()
-		r.Content[mt] = Media{Schema: *s}
+		r.Content[mt] = Media{*s}
 	}
 	return r
 }
diff --git a/internal/gen/_template/cfg.tmpl b/gen/_template/cfg.tmpl
similarity index 95%
rename from internal/gen/_template/cfg.tmpl
rename to gen/_template/cfg.tmpl
index ccb4c89f..81b6edb2 100644
--- a/internal/gen/_template/cfg.tmpl
+++ b/gen/_template/cfg.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "cfg" }}
 {{ $pkg := $.Package }}
diff --git a/internal/gen/_template/client.tmpl b/gen/_template/client.tmpl
similarity index 98%
rename from internal/gen/_template/client.tmpl
rename to gen/_template/client.tmpl
index 25921b33..e3fc65a6 100644
--- a/internal/gen/_template/client.tmpl
+++ b/gen/_template/client.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "client" }}
 {{ $pkg := $.Package }}
diff --git a/internal/gen/_template/handlers.tmpl b/gen/_template/handlers.tmpl
similarity index 96%
rename from internal/gen/_template/handlers.tmpl
rename to gen/_template/handlers.tmpl
index 0aaa2e7f..7edf721f 100644
--- a/internal/gen/_template/handlers.tmpl
+++ b/gen/_template/handlers.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "handlers" }}
 {{ $pkg := $.Package }}
diff --git a/internal/gen/_template/header.tmpl b/gen/_template/header.tmpl
similarity index 94%
rename from internal/gen/_template/header.tmpl
rename to gen/_template/header.tmpl
index 51e3e679..eb9dcd0f 100644
--- a/internal/gen/_template/header.tmpl
+++ b/gen/_template/header.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "header" }}
 // Code generated by ogen, DO NOT EDIT.
diff --git a/internal/gen/_template/interfaces.tmpl b/gen/_template/interfaces.tmpl
similarity index 78%
rename from internal/gen/_template/interfaces.tmpl
rename to gen/_template/interfaces.tmpl
index 39437377..28d5215d 100644
--- a/internal/gen/_template/interfaces.tmpl
+++ b/gen/_template/interfaces.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "interfaces" }}
 // Code generated by ogen, DO NOT EDIT.
diff --git a/internal/gen/_template/json.tmpl b/gen/_template/json.tmpl
similarity index 98%
rename from internal/gen/_template/json.tmpl
rename to gen/_template/json.tmpl
index 634623ad..d10fc48e 100644
--- a/internal/gen/_template/json.tmpl
+++ b/gen/_template/json.tmpl
@@ -1,5 +1,5 @@
 {{ define "json" }}
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ $pkg := $.Package }}
 {{ template "header" $ }}
diff --git a/internal/gen/_template/json_dec.tmpl b/gen/_template/json_dec.tmpl
similarity index 96%
rename from internal/gen/_template/json_dec.tmpl
rename to gen/_template/json_dec.tmpl
index 15714938..c96630a8 100644
--- a/internal/gen/_template/json_dec.tmpl
+++ b/gen/_template/json_dec.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.Elem*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.Elem*/ -}}
 
 {{- define "dec_json_pointer" }}
 {{ $.Var }} = nil
diff --git a/internal/gen/_template/json_enc.tmpl b/gen/_template/json_enc.tmpl
similarity index 97%
rename from internal/gen/_template/json_enc.tmpl
rename to gen/_template/json_enc.tmpl
index d78ce9b6..d7b4a1b1 100644
--- a/internal/gen/_template/json_enc.tmpl
+++ b/gen/_template/json_enc.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.Elem*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.Elem*/ -}}
 
 {{/* Encode field */}}
 {{- define "enc_json_field" -}}
diff --git a/internal/gen/_template/param.tmpl b/gen/_template/param.tmpl
similarity index 84%
rename from internal/gen/_template/param.tmpl
rename to gen/_template/param.tmpl
index cd2d8c64..be05b5b8 100644
--- a/internal/gen/_template/param.tmpl
+++ b/gen/_template/param.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "param" }}
 {{ $pkg := $.Package }}
diff --git a/internal/gen/_template/param_dec.tmpl b/gen/_template/param_dec.tmpl
similarity index 97%
rename from internal/gen/_template/param_dec.tmpl
rename to gen/_template/param_dec.tmpl
index 4a0cdd82..3716a794 100644
--- a/internal/gen/_template/param_dec.tmpl
+++ b/gen/_template/param_dec.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "param_dec" }}
 {{ $pkg := $.Package }}
diff --git a/internal/gen/_template/param_enc.tmpl b/gen/_template/param_enc.tmpl
similarity index 100%
rename from internal/gen/_template/param_enc.tmpl
rename to gen/_template/param_enc.tmpl
diff --git a/internal/gen/_template/req_dec.tmpl b/gen/_template/req_dec.tmpl
similarity index 95%
rename from internal/gen/_template/req_dec.tmpl
rename to gen/_template/req_dec.tmpl
index baeb6b46..dcf96612 100644
--- a/internal/gen/_template/req_dec.tmpl
+++ b/gen/_template/req_dec.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 {{ define "req_dec" }}
 {{ $pkg := $.Package }}
 {{ template "header" $ }}
diff --git a/internal/gen/_template/req_enc.tmpl b/gen/_template/req_enc.tmpl
similarity index 92%
rename from internal/gen/_template/req_enc.tmpl
rename to gen/_template/req_enc.tmpl
index fb59a594..66972733 100644
--- a/internal/gen/_template/req_enc.tmpl
+++ b/gen/_template/req_enc.tmpl
@@ -9,7 +9,7 @@ if _, err := e.WriteTo(buf); err != nil {
 }
 {{ end }}
 
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 {{ define "req_enc" }}
 {{ $pkg := $.Package }}
 {{ template "header" $ }}
diff --git a/internal/gen/_template/res_dec.tmpl b/gen/_template/res_dec.tmpl
similarity index 95%
rename from internal/gen/_template/res_dec.tmpl
rename to gen/_template/res_dec.tmpl
index 82076d68..4b5c90c7 100644
--- a/internal/gen/_template/res_dec.tmpl
+++ b/gen/_template/res_dec.tmpl
@@ -20,7 +20,7 @@ if err := func() error {
 {{ end }}
 
 {{ define "res_dec" }}
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 {{ $pkg := $.Package }}
 {{ template "header" $ }}
 
@@ -53,7 +53,7 @@ func decode{{ $op.Name }}Response(resp *http.Response, span trace.Span) (res {{
 {{ end }}
 
 {{- define "dec_res" }}
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.ResponseElem*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.ResponseElem*/ -}}
 {{- $response := $.Response }}
 {{- $ptr := $.Ptr }}
 {{- if $response.NoContent }}{{/* Decode NoContent response */}}
diff --git a/internal/gen/_template/res_enc.tmpl b/gen/_template/res_enc.tmpl
similarity index 96%
rename from internal/gen/_template/res_enc.tmpl
rename to gen/_template/res_enc.tmpl
index 5622e502..08c691a5 100644
--- a/internal/gen/_template/res_enc.tmpl
+++ b/gen/_template/res_enc.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "res_enc" }}
 {{ $pkg := $.Package }}
diff --git a/internal/gen/_template/router.tmpl b/gen/_template/router.tmpl
similarity index 94%
rename from internal/gen/_template/router.tmpl
rename to gen/_template/router.tmpl
index a31853f0..433e37f6 100644
--- a/internal/gen/_template/router.tmpl
+++ b/gen/_template/router.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 {{ define "router" }}
 {{ template "header" $ }}
 
@@ -52,7 +52,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 {{ end }}
 
 {{ define "route_edge" }}
-	{{- /*gotype: github.com/ogen-go/ogen/internal/gen.RouteEge*/ -}}
+	{{- /*gotype: github.com/ogen-go/ogen/gen.RouteEge*/ -}}
 	{{- if $.Param }}
 		if args == nil {
 			args = make(map[string]string)
diff --git a/internal/gen/_template/schemas.tmpl b/gen/_template/schemas.tmpl
similarity index 98%
rename from internal/gen/_template/schemas.tmpl
rename to gen/_template/schemas.tmpl
index 35754ecc..f4945b59 100644
--- a/internal/gen/_template/schemas.tmpl
+++ b/gen/_template/schemas.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "schemas" }}
 {{ $pkg := $.Package }}
diff --git a/internal/gen/_template/server.tmpl b/gen/_template/server.tmpl
similarity index 93%
rename from internal/gen/_template/server.tmpl
rename to gen/_template/server.tmpl
index 1f823dd7..018f0637 100644
--- a/internal/gen/_template/server.tmpl
+++ b/gen/_template/server.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ define "server" }}
 {{ $pkg := $.Package }}
diff --git a/internal/gen/_template/uri_dec.tmpl b/gen/_template/uri_dec.tmpl
similarity index 94%
rename from internal/gen/_template/uri_dec.tmpl
rename to gen/_template/uri_dec.tmpl
index 87763c41..2731b971 100644
--- a/internal/gen/_template/uri_dec.tmpl
+++ b/gen/_template/uri_dec.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 {{- define "uri_dec" }}
 {{- template "header" $ }}
 
@@ -28,7 +28,7 @@ func (v *{{ $t.Go }}) decodeURI(d uri.Decoder) error {
 {{- end }}
 
 {{- define "dec_uri" }}
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.Elem*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.Elem*/ -}}
 {{- $t := $.Type }}
 {{- $var := $.Var }}
 {{- $tmpVar := camelSpecial (printf "%sVal" $var) }}
diff --git a/internal/gen/_template/uri_enc.tmpl b/gen/_template/uri_enc.tmpl
similarity index 93%
rename from internal/gen/_template/uri_enc.tmpl
rename to gen/_template/uri_enc.tmpl
index a0a9ffae..877c1e51 100644
--- a/internal/gen/_template/uri_enc.tmpl
+++ b/gen/_template/uri_enc.tmpl
@@ -1,4 +1,4 @@
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 {{- define "uri_enc" }}
 {{- template "header" $ }}
 
@@ -22,7 +22,7 @@ func (v {{ $t.Go }}) encodeURI(e uri.Encoder) error {
 {{- end }}
 
 {{- define "enc_uri" }}
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.Elem*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.Elem*/ -}}
 {{- $t := $.Type }}
 {{- $var := $.Var }}
 {{- if $t.IsPrimitive }}
diff --git a/internal/gen/_template/validators.tmpl b/gen/_template/validators.tmpl
similarity index 97%
rename from internal/gen/_template/validators.tmpl
rename to gen/_template/validators.tmpl
index dbc4b112..8632362d 100644
--- a/internal/gen/_template/validators.tmpl
+++ b/gen/_template/validators.tmpl
@@ -1,5 +1,5 @@
 {{- define "validate" }}
-	{{- /*gotype: github.com/ogen-go/ogen/internal/gen.Elem*/ -}}
+	{{- /*gotype: github.com/ogen-go/ogen/gen.Elem*/ -}}
 	{{- $t := $.Type }}
 	{{- $va := $t.Validators }}
 	{{- $validated := false }}
@@ -118,7 +118,7 @@
 {{- end }}
 
 {{ define "validators" }}
-{{- /*gotype: github.com/ogen-go/ogen/internal/gen.TemplateConfig*/ -}}
+{{- /*gotype: github.com/ogen-go/ogen/gen.TemplateConfig*/ -}}
 
 {{ $pkg := $.Package }}
 {{ template "header" $ }}
diff --git a/spec.go b/spec.go
index b0968391..1216d4bb 100644
--- a/spec.go
+++ b/spec.go
@@ -16,13 +16,6 @@ type Spec struct {
 	Servers    []Server    `json:"servers,omitempty"`
 	Paths      Paths       `json:"paths,omitempty"`
 	Components *Components `json:"components,omitempty"`
-
-	// A list of tags used by the specification with additional metadata.
-	// The order of the tags can be used to reflect on their order by the parsing
-	// tools. Not all tags that are used by the Operation Object must be declared.
-	// The tags that are not declared MAY be organized randomly or based on the tools' logic.
-	// Each tag name in the list MUST be unique.
-	Tags []Tag `json:"tags,omitempty"`
 }
 
 // Init components of schema.
@@ -44,28 +37,6 @@ func (s *Spec) Init() {
 	if c.RequestBodies == nil {
 		c.RequestBodies = make(map[string]*RequestBody)
 	}
-	if c.Examples == nil {
-		c.Examples = make(map[string]*Example)
-	}
-}
-
-// Example object.
-//
-// https://swagger.io/specification/#example-object
-type Example struct {
-	Ref           string          `json:"$ref,omitempty"` // ref object
-	Summary       string          `json:"summary,omitempty"`
-	Description   string          `json:"description,omitempty"`
-	Value         json.RawMessage `json:"value,omitempty"`
-	ExternalValue string          `json:"externalValue,omitempty"`
-}
-
-// Tag object.
-//
-// https://swagger.io/specification/#tag-object
-type Tag struct {
-	Name        string `json:"name"`
-	Description string `json:"description,omitempty"`
 }
 
 // Info provides metadata about the API.
@@ -111,12 +82,11 @@ type Server struct {
 // All objects defined within the components object will have no effect on the API
 // unless they are explicitly referenced from properties outside the components object.
 type Components struct {
-	Schemas       map[string]*Schema      `json:"schemas,omitempty"`
-	Responses     map[string]*Response    `json:"responses,omitempty"`
-	Parameters    map[string]*Parameter   `json:"parameters,omitempty"`
-	Examples      map[string]*Example     `json:"examples,omitempty"`
+	Schemas    map[string]*Schema    `json:"schemas,omitempty"`
+	Responses  map[string]*Response  `json:"responses,omitempty"`
+	Parameters map[string]*Parameter `json:"parameters,omitempty"`
+	// Examples        map[string]Example         `json:"example"`
 	RequestBodies map[string]*RequestBody `json:"requestBodies,omitempty"`
-
 	// Headers         map[string]Header          `json:"headers"`
 	// SecuritySchemes map[string]SecuritySchema  `json:"securitySchemes"`
 	// Links           map[string]Link            `json:"links"`
@@ -162,7 +132,6 @@ type Operation struct {
 	Parameters  []*Parameter `json:"parameters,omitempty"`
 	RequestBody *RequestBody `json:"requestBody,omitempty"`
 	Responses   Responses    `json:"responses,omitempty"`
-	Deprecated  bool         `json:"deprecated,omitempty"`
 }
 
 // Parameter describes a single operation parameter.
@@ -205,9 +174,6 @@ type Parameter struct {
 	// or key-value pair of the map.
 	// For other types of parameters this property has no effect.
 	Explode *bool `json:"explode,omitempty"`
-
-	Example  json.RawMessage     `json:"example,omitempty"`
-	Examples map[string]*Example `json:"examples,omitempty"`
 }
 
 // RequestBody describes a single request body.
@@ -242,9 +208,7 @@ type Response struct {
 // Media provides schema and examples for the media type identified by its key.
 type Media struct {
 	// The schema defining the content of the request, response, or parameter.
-	Schema   Schema              `json:"schema"`
-	Example  json.RawMessage     `json:"example,omitempty"`
-	Examples map[string]*Example `json:"examples,omitempty"`
+	Schema Schema `json:"schema"`
 }
 
 // Discriminator discriminates types for OneOf, AllOf, AnyOf.
@@ -256,7 +220,7 @@ type Discriminator struct {
 // The Schema Object allows the definition of input and output data types.
 // These types can be objects, but also primitives and arrays.
 type Schema struct {
-	Ref         string `json:"$ref,omitempty"` // ref object
+	Ref         string `json:"$ref,omitempty"`
 	Description string `json:"description,omitempty"`
 
 	// Value MUST be a string. Multiple types via an array are not supported.
@@ -277,7 +241,7 @@ type Schema struct {
 	Required []string `json:"required,omitempty"`
 
 	// Value MUST be an object and not an array.
-	// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema.
+	// Inline or referenced schema MUST be of a Schema Object and not a standard JSON Schema. 
 	// MUST be present if the Type is "array".
 	Items *Schema `json:"items,omitempty"`
 
@@ -433,15 +397,6 @@ type Schema struct {
 
 	// Default value.
 	Default json.RawMessage `json:"default,omitempty"` // TODO: support
-
-	// A free-form property to include an example of an instance for this schema.
-	// To represent examples that cannot be naturally represented in JSON or YAML,
-	// a string value can be used to contain the example with escaping where necessary.
-	Example json.RawMessage `json:"example,omitempty"`
-
-	// Specifies that a schema is deprecated and SHOULD be transitioned out
-	// of usage.
-	Deprecated bool `json:"deprecated,omitempty"`
 }
 
 type Property struct {


Test patch:
diff --git a/internal/gen/errors.go b/gen/errors.go
similarity index 100%
rename from internal/gen/errors.go
rename to gen/errors.go
diff --git a/internal/gen/gen_operation.go b/gen/gen_operation.go
similarity index 100%
rename from internal/gen/gen_operation.go
rename to gen/gen_operation.go
diff --git a/internal/gen/gen_parameters.go b/gen/gen_parameters.go
similarity index 100%
rename from internal/gen/gen_parameters.go
rename to gen/gen_parameters.go
diff --git a/internal/gen/gen_request_body.go b/gen/gen_request_body.go
similarity index 100%
rename from internal/gen/gen_request_body.go
rename to gen/gen_request_body.go
diff --git a/internal/gen/gen_responses.go b/gen/gen_responses.go
similarity index 100%
rename from internal/gen/gen_responses.go
rename to gen/gen_responses.go
diff --git a/internal/gen/gen_schema.go b/gen/gen_schema.go
similarity index 100%
rename from internal/gen/gen_schema.go
rename to gen/gen_schema.go
diff --git a/internal/gen/generator.go b/gen/generator.go
similarity index 100%
rename from internal/gen/generator.go
rename to gen/generator.go
diff --git a/internal/gen/generics.go b/gen/generics.go
similarity index 100%
rename from internal/gen/generics.go
rename to gen/generics.go
diff --git a/internal/gen/names.go b/gen/names.go
similarity index 100%
rename from internal/gen/names.go
rename to gen/names.go
diff --git a/internal/gen/names_test.go b/gen/names_test.go
similarity index 100%
rename from internal/gen/names_test.go
rename to gen/names_test.go
diff --git a/internal/gen/reduce.go b/gen/reduce.go
similarity index 100%
rename from internal/gen/reduce.go
rename to gen/reduce.go
diff --git a/internal/gen/registry.go b/gen/registry.go
similarity index 100%
rename from internal/gen/registry.go
rename to gen/registry.go
diff --git a/internal/gen/router.go b/gen/router.go
similarity index 100%
rename from internal/gen/router.go
rename to gen/router.go
diff --git a/internal/gen/schema_gen.go b/gen/schema_gen.go
similarity index 100%
rename from internal/gen/schema_gen.go
rename to gen/schema_gen.go
diff --git a/internal/gen/templates.go b/gen/templates.go
similarity index 100%
rename from internal/gen/templates.go
rename to gen/templates.go
diff --git a/internal/gen/utils.go b/gen/utils.go
similarity index 100%
rename from internal/gen/utils.go
rename to gen/utils.go
diff --git a/internal/gen/walk.go b/gen/walk.go
similarity index 100%
rename from internal/gen/walk.go
rename to gen/walk.go
diff --git a/internal/gen/write.go b/gen/write.go
similarity index 100%
rename from internal/gen/write.go
rename to gen/write.go
diff --git a/gen_test.go b/gen_test.go
index 681a515f..8066662f 100644
--- a/gen_test.go
+++ b/gen_test.go
@@ -9,7 +9,7 @@ import (
 	"github.com/stretchr/testify/require"
 
 	"github.com/ogen-go/ogen"
-	"github.com/ogen-go/ogen/internal/gen"
+	"github.com/ogen-go/ogen/gen"
 )
 
 //go:embed _testdata