{"id":23917980,"url":"https://github.com/flum1025/sql-enum-generator","last_synced_at":"2025-08-13T15:47:20.715Z","repository":{"id":270128674,"uuid":"909331079","full_name":"flum1025/sql-enum-generator","owner":"flum1025","description":"sql-enum-generator is a tool that parses SQL INSERT statements from a file and automatically generates OpenAPI schema files.  The generated OpenAPI schema can be used with existing tools to generate type definitions in various programming languages.","archived":false,"fork":false,"pushed_at":"2024-12-29T08:33:01.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-05T13:11:49.600Z","etag":null,"topics":["code-generator","go","openapi3","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flum1025.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-28T11:35:54.000Z","updated_at":"2024-12-29T08:33:04.000Z","dependencies_parsed_at":"2024-12-28T17:37:06.081Z","dependency_job_id":null,"html_url":"https://github.com/flum1025/sql-enum-generator","commit_stats":null,"previous_names":["flum1025/sql-enum-generator"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flum1025%2Fsql-enum-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flum1025%2Fsql-enum-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flum1025%2Fsql-enum-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flum1025%2Fsql-enum-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flum1025","download_url":"https://codeload.github.com/flum1025/sql-enum-generator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240371756,"owners_count":19790888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generator","go","openapi3","postgresql","sql"],"created_at":"2025-01-05T13:11:48.601Z","updated_at":"2025-02-23T20:15:43.351Z","avatar_url":"https://github.com/flum1025.png","language":"Go","readme":"# sql-enum-generator\n\nsql-enum-generator is a tool that converts SQL INSERT statements for master data into OpenAPI schemas. This application enables developers to easily generate enum representations of database master data using OpenAPI specifications, streamlining the development process and ensuring consistency between the database and application code.\n\nCurrently only postgresql is supported.\n\n## Features\n\n- Parses SQL INSERT statements and generates corresponding OpenAPI schemas\n- Generated OpenAPI schemas can be utilized with other tools for type generation\n\n## Quick Start\n\n1. **Create a configuration file** named `sqlenumgen.yml` with the following content:\n\n```yaml\nversion: \"1\"\ntables:\n  - name: products\n    key: name\n    value: id\n```\n\n2. **Run the application** using the following command:\n\n```sh\n$ go run github.com/flum1025/sql-enum-generator generate --source-path ./example/master.sql --output-path ./example/openapi.generated.json --config ./example/sqlenumgen.yml\n```\n\n3. **Utilize language-specific generation tools** to create enums from the generated OpenAPI schema.\n\nFor actual generation examples, please refer to the `example` directory in the repository.\n\n## Language-Specific Usage Examples\n\n### Go\n\nFor Go, you can use [oapi-codegen](https://github.com/oapi-codegen/oapi-codegen) to generate code from the OpenAPI schema. Create a configuration file named `oapi-codegen.yml` with the following content:\n\n```yaml\npackage: main\noutput: ./openapi.generated.go\ngenerate:\n  models: true\ncompatibility:\n  always-prefix-enum-values: true\noutput-options:\n  skip-prune: true\n```\n\nThen, run the following command to generate the Go code:\n\n```sh\n$ go run github.com/oapi-codegen/oapi-codegen/v2/cmd/oapi-codegen -config ./example/oapi-codegen.yml ./example/openapi.generated.json\n```\n\n### TypeScript\n\nFor TypeScript, you can use [openapi-typescript](https://github.com/openapi-ts/openapi-typescript) to generate TypeScript definitions. Run the following command:\n\n```sh\n$ npx openapi-typescript ./example/openapi.generated.json -o ./example/openapi.generated.d.ts --enum\n```\n\n## Future Plans\n\n- [ ] Add support for additional SQL dialects\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflum1025%2Fsql-enum-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflum1025%2Fsql-enum-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflum1025%2Fsql-enum-generator/lists"}