{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/sqlc-configuration/latest.json",
  "x-lintel": {
    "source": "https://www.schemastore.org/sqlc-2.0.json",
    "sourceSha256": "8b8d79dca8550220230ef77f802e333c94d53c8878f458879e63cd93fdd08fb9",
    "fileMatch": [
      "sqlc.yaml",
      "sqlc.json",
      "*.sqlc.yaml"
    ],
    "parsers": [
      "json",
      "yaml"
    ]
  },
  "type": "object",
  "properties": {
    "version": {
      "const": "2"
    },
    "project": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        }
      }
    },
    "cloud": {
      "type": "object",
      "properties": {
        "organization": {
          "type": "string"
        },
        "project": {
          "type": "string"
        },
        "hostname": {
          "type": "string"
        }
      }
    },
    "sql": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "engine"
        ],
        "properties": {
          "engine": {
            "description": "One of postgresql, mysql or sqlite.",
            "enum": [
              "postgresql",
              "mysql",
              "sqlite"
            ]
          },
          "rules": {
            "description": "A collection of rule names to run via sqlc vet. See rules for configuration options.",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "codegen": {
            "description": "A collection of mappings to configure code generators. See codegen for the supported keys.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "out": {
                  "description": "Output directory for generated code.",
                  "type": "string"
                },
                "plugin": {
                  "description": "The name of the plugin. Must be defined in the plugins collection.",
                  "type": "string"
                },
                "options": {
                  "description": "A mapping of plugin-specific options.",
                  "type": "object"
                }
              }
            }
          },
          "schema": {
            "description": "Directory of SQL migrations or path to single SQL file; or a list of paths.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "queries": {
            "description": "Directory of SQL queries or path to single SQL file; or a list of paths.",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            ]
          },
          "database": {
            "description": "A mapping to configure database connections. See database for the supported keys.\n\n",
            "type": "object",
            "properties": {
              "uri": {
                "description": "Database connection URI",
                "type": "string"
              }
            }
          },
          "strict_function_checks": {
            "description": "If true, return an error if a called SQL function does not exist. Defaults to false.",
            "type": "boolean",
            "default": false
          },
          "strict_order_by": {
            "type": "boolean"
          },
          "gen": {
            "description": "A mapping to configure built-in code generators. See gen for the supported keys.",
            "type": "object",
            "properties": {
              "json": {
                "type": "object",
                "properties": {
                  "out": {
                    "description": "Output directory for the generated JSON.",
                    "type": "string"
                  },
                  "indent": {
                    "description": "Indent string to use in the JSON document. Defaults to two spaces.",
                    "default": "  ",
                    "type": "string"
                  },
                  "filename": {
                    "description": "Filename for the generated JSON document. Defaults to codegen_request.json.",
                    "default": "codegen_request.json",
                    "type": "string"
                  }
                }
              },
              "go": {
                "type": "object",
                "properties": {
                  "emit_interface": {
                    "description": "If true, output a Querier interface in the generated package. Defaults to false.",
                    "default": false,
                    "type": "boolean"
                  },
                  "emit_json_tags": {
                    "type": "boolean",
                    "description": "If true, add JSON tags to generated structs. Defaults to false.",
                    "default": false
                  },
                  "json_tags_id_uppercase": {
                    "description": "If true, “Id” in json tags will be uppercase. If false, will be camelcase. Defaults to false",
                    "default": false,
                    "type": "boolean"
                  },
                  "emit_db_tags": {
                    "description": "If true, add DB tags to generated structs. Defaults to false.",
                    "default": false,
                    "type": "boolean"
                  },
                  "emit_prepared_queries": {
                    "description": "If true, include support for prepared queries. Defaults to false.",
                    "default": false,
                    "type": "boolean"
                  },
                  "emit_exact_table_names": {
                    "type": "boolean",
                    "description": "If true, struct names will mirror table names. Otherwise, sqlc attempts to singularize plural table names. Defaults to false.",
                    "default": false
                  },
                  "emit_empty_slices": {
                    "description": "If true, slices returned by :many queries will be empty instead of nil. Defaults to false.",
                    "default": false,
                    "type": "boolean"
                  },
                  "emit_exported_queries": {
                    "description": "If true, autogenerated SQL statement can be exported to be accessed by another package.",
                    "type": "boolean"
                  },
                  "emit_result_struct_pointers": {
                    "description": "If true, query results are returned as pointers to structs. Queries returning multiple results are returned as slices of pointers. Defaults to false.",
                    "default": false,
                    "type": "boolean"
                  },
                  "emit_params_struct_pointers": {
                    "description": "If true, parameters are passed as pointers to structs. Defaults to false.",
                    "default": false,
                    "type": "boolean"
                  },
                  "emit_methods_with_db_argument": {
                    "description": "If true, generated methods will accept a DBTX argument instead of storing a DBTX on the *Queries struct. Defaults to false.",
                    "type": "boolean",
                    "default": false
                  },
                  "emit_pointers_for_null_types": {
                    "type": "boolean"
                  },
                  "emit_enum_valid_method": {
                    "description": "If true, generate a Valid method on enum types, indicating whether a string is a valid enum value.",
                    "type": "boolean"
                  },
                  "emit_all_enum_values": {
                    "description": "If true, emit a function per enum type that returns all valid enum values.",
                    "type": "boolean"
                  },
                  "json_tags_case_style": {
                    "type": "string",
                    "description": "camel for camelCase, pascal for PascalCase, snake for snake_case or none to use the column name in the DB. Defaults to none.",
                    "default": "none"
                  },
                  "package": {
                    "description": "The package name to use for the generated code. Defaults to out basename.",
                    "type": "string"
                  },
                  "out": {
                    "description": "Output directory for generated code.",
                    "type": "string"
                  },
                  "overrides": {
                    "description": "<https://docs.sqlc.dev/en/stable/reference/config.html#type-overriding>",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "go_type": {
                          "description": "A fully qualified name to a Go type to use in the generated code.",
                          "oneOf": [
                            {
                              "type": "object",
                              "properties": {
                                "import": {
                                  "description": "The import path for the package where the type is defined.",
                                  "type": "string"
                                },
                                "package": {
                                  "description": "The package name where the type is defined. This should only be necessary when your import path doesn’t end with the desired package name.",
                                  "type": "string"
                                },
                                "type": {
                                  "description": "The type name itself, without any package prefix.",
                                  "type": "string"
                                },
                                "pointer": {
                                  "description": "If set to true, generated code will use pointers to the type rather than the type itself.",
                                  "type": "boolean"
                                },
                                "slice": {
                                  "description": "If set to true, generated code will use a slice of the type rather than the type itself.",
                                  "type": "boolean"
                                },
                                "spec": {
                                  "type": "string"
                                },
                                "builtin": {
                                  "type": "boolean"
                                }
                              }
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "go_struct_tag": {
                          "description": "A reflect-style struct tag to use in the generated code, e.g. a:\"b\" x:\"y,z\". If you want general json/db tags for all fields, use emit_db_tags and/or emit_json_tags instead.",
                          "type": "string"
                        },
                        "db_type": {
                          "description": "The PostgreSQL or MySQL type to override. Find the full list of supported types in postgresql_type.go or mysql_type.go. Note that for Postgres you must use the pg_catalog prefixed names where available. Can’t be used if the column key is defined.",
                          "type": "string"
                        },
                        "engine": {
                          "enum": [
                            "postgresql",
                            "mysql",
                            "sqlite"
                          ]
                        },
                        "nullable": {
                          "description": "If true, use this type when a column is nullable. Defaults to false.",
                          "default": false,
                          "type": "boolean"
                        },
                        "unsigned": {
                          "type": "boolean"
                        },
                        "column": {
                          "description": "In case the type overriding should be done on specific a column of a table instead of a type. column should be of the form table.column but you can be even more specific by specifying schema.table.column or catalog.schema.table.column. Can’t be used if the db_type key is defined.",
                          "type": "string"
                        }
                      }
                    }
                  },
                  "rename": {
                    "description": "<https://docs.sqlc.dev/en/stable/reference/config.html#renaming-fields>",
                    "type": "object",
                    "patternProperties": {
                      ".*": {
                        "type": "string"
                      }
                    }
                  },
                  "sql_package": {
                    "description": "Either pgx/v4, pgx/v5 or database/sql. Defaults to database/sql.",
                    "type": "string"
                  },
                  "sql_driver": {
                    "type": "string"
                  },
                  "output_batch_file_name": {
                    "description": "Customize the name of the batch file. Defaults to batch.go.",
                    "default": "batch.go",
                    "type": "string"
                  },
                  "output_db_file_name": {
                    "description": "Customize the name of the db file. Defaults to db.go.",
                    "default": "db.go",
                    "type": "string"
                  },
                  "output_models_file_name": {
                    "description": "Customize the name of the models file. Defaults to models.go.",
                    "default": "models.go",
                    "type": "string"
                  },
                  "output_querier_file_name": {
                    "description": "Customize the name of the querier file. Defaults to querier.go.",
                    "default": "querier.go",
                    "type": "string"
                  },
                  "output_files_suffix": {
                    "type": "string",
                    "description": "If specified the suffix will be added to the name of the generated files."
                  },
                  "inflection_exclude_table_names": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "query_parameter_limit": {
                    "type": "integer",
                    "description": "The number of positional arguments that will be generated for Go functions. To always emit a parameter struct, set this to 0. Defaults to 1.",
                    "default": 1
                  },
                  "omit_unused_structs": {
                    "type": "boolean",
                    "description": "If true, sqlc won’t generate table and enum structs that aren’t used in queries for a given package. Defaults to false.",
                    "default": false
                  }
                }
              }
            }
          }
        }
      }
    },
    "overrides": {
      "description": "<https://docs.sqlc.dev/en/latest/reference/config.html#global-overrides>",
      "type": "object",
      "properties": {
        "go": {
          "type": "object",
          "properties": {
            "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"
                }
              }
            }
          }
        }
      }
    },
    "plugins": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "description": "The name of this plugin.",
            "type": "string",
            "minLength": 1
          },
          "env": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "process": {
            "type": "object",
            "properties": {
              "cmd": {
                "description": "The executable to call when using this plugin",
                "type": "string"
              }
            }
          },
          "wasm": {
            "type": "object",
            "description": "wasm: A mapping with a two keys url and sha256",
            "properties": {
              "url": {
                "description": "The URL to fetch the WASM file. Supports the <https://> or file:// schemes.",
                "type": "string"
              },
              "sha256": {
                "description": "The SHA256 checksum for the downloaded file.",
                "type": "string"
              }
            }
          }
        }
      }
    },
    "rules": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "description": "The name of this rule. (Required)",
            "type": "string"
          },
          "rule": {
            "description": "A Common Expression Language (CEL) expression. Required.",
            "type": "string"
          },
          "message": {
            "description": "An optional message shown when this rule evaluates to true.",
            "type": "string"
          }
        }
      }
    }
  },
  "required": [
    "version"
  ]
}
