Skip to content

feat(config): Add JSON schema files for configs #2703

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

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (
github.com/riza-io/grpc-go v0.2.0
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.57.0
google.golang.org/protobuf v1.31.0
Expand All @@ -29,6 +30,8 @@ require (
require (
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/pingcap/failpoint v0.0.0-20220801062533-2eaa32854a6c // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230803162519-f966b187b2e5 // indirect
)
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHovont7NscjpAxXsDA8S8BMYve8Y5+7cuRE7R0=
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ=
github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74=
github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
Expand Down
334 changes: 334 additions & 0 deletions internal/config/v_one.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,334 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"type": "object",
"required": [
"version"
],
"properties": {
"version": {
"const": "1"
},
"project": {
"type": "object",
"properties": {
"id": {
"type": "string"
}
}
},
"cloud": {
"type": "object",
"properties": {
"organization": {
"type": "string"
},
"project": {
"type": "string"
},
"hostname": {
"type": "string"
}
}
},
"packages": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"required": [
"engine"
],
"properties": {
"engine": {
"enum": [
"postgresql",
"mysql",
"sqlite"
]
},
"schema": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"queries": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
},
"database": {
"type": "object",
"properties": {
"uri": {
"type": "string"
}
}
},
"strict_function_checks": {
"type": "boolean"
},
"strict_order_by": {
"type": "boolean"
},
"emit_interface": {
"type": "boolean"
},
"emit_json_tags": {
"type": "boolean"
},
"json_tags_id_uppercase": {
"type": "boolean"
},
"emit_db_tags": {
"type": "boolean"
},
"emit_prepared_queries": {
"type": "boolean"
},
"emit_exact_table_names": {
"type": "boolean"
},
"emit_empty_slices": {
"type": "boolean"
},
"emit_exported_queries": {
"type": "boolean"
},
"emit_result_struct_pointers": {
"type": "boolean"
},
"emit_params_struct_pointers": {
"type": "boolean"
},
"emit_methods_with_db_argument": {
"type": "boolean"
},
"emit_pointers_for_null_types": {
"type": "boolean"
},
"emit_enum_valid_method": {
"type": "boolean"
},
"emit_all_enum_values": {
"type": "boolean"
},
"json_tags_case_style": {
"type": "string"
},
"package": {
"type": "string"
},
"out": {
"type": "string"
},
"overrides": {
"type": "array",
"items": {
"type": "object",
"properties": {
"go_type": {
"oneOf": [
{
"type": "object",
"properties": {
"import": {
"type": "string"
},
"package": {
"type": "string"
},
"type": {
"type": "string"
},
"pointer": {
"type": "boolean"
},
"slice": {
"type": "boolean"
},
"spec": {
"type": "string"
},
"builtin": {
"type": "boolean"
}
}
},
{
"type": "string"
}
]
},
"go_struct_tag": {
"type": "string"
},
"db_type": {
"type": "string"
},
"engine": {
"enum": [
"postgresql",
"mysql",
"sqlite"
]
},
"nullable": {
"type": "boolean"
},
"unsigned": {
"type": "boolean"
},
"column": {
"type": "string"
}
}
}
},
"sql_package": {
"type": "string"
},
"sql_driver": {
"type": "string"
},
"output_batch_file_name": {
"type": "string"
},
"output_db_file_name": {
"type": "string"
},
"output_models_file_name": {
"type": "string"
},
"output_querier_file_name": {
"type": "string"
},
"output_files_suffix": {
"type": "string"
},
"inflection_exclude_table_names": {
"type": "array",
"items": {
"type": "string"
}
},
"query_parameter_limit": {
"type": "integer"
},
"omit_unused_structs": {
"type": "boolean"
},
"rules": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"overrides": {
"type": "array",
"items": {
"type": "object",
"properties": {
"go_type": {
"oneOf": [
{
"type": "object",
"properties": {
"import": {
"type": "string"
},
"package": {
"type": "string"
},
"type": {
"type": "string"
},
"pointer": {
"type": "boolean"
},
"slice": {
"type": "boolean"
},
"spec": {
"type": "string"
},
"builtin": {
"type": "boolean"
}
}
},
{
"type": "string"
}
]
},
"go_struct_tag": {
"type": "string"
},
"db_type": {
"type": "string"
},
"engine": {
"enum": [
"postgresql",
"mysql",
"sqlite"
]
},
"nullable": {
"type": "boolean"
},
"unsigned": {
"type": "boolean"
},
"column": {
"type": "string"
}
}
}
}
},
"rename": {
"type": "object",
"patternProperties": {
".*": {
"type": "string"
}
}
},
"rules": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"rule": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
Loading