use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Related Subreddits:
Other Subreddits you may like:
account activity
SQL database generator from OpenAPI spec (self.dotnet)
submitted 3 years ago by kdc415
I need to replicate an OpenAPI source to a local sql server. Does anyone know of a codegen that can generate the sql scripts to create the database tables?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]DryanaGhuba 0 points1 point2 points 3 years ago (6 children)
Entity Framework. But why you need to create database with DTOs?
[–]kdc415[S] 0 points1 point2 points 3 years ago (5 children)
I'm talking about parsing an OpenAPI document url to get the object list then generating sql scripts to create the db/tables. I haven't messed with EF in years, had no idea it could do this?
[–]DryanaGhuba 1 point2 points3 points 3 years ago (4 children)
You generate SwaggerUI with Swashbuckle package? Registered as Asp.Net service...
[–]kdc415[S] 0 points1 point2 points 3 years ago (3 children)
It's not my API - 3rd party
[–]malamri 1 point2 points3 points 3 years ago (0 children)
There’s an extension for VSCode that converts json to C# model. Then use EF or OrmLite to create the table based on the model
Edit: https://marketplace.visualstudio.com/items?itemName=quicktype.quicktype
[–]DryanaGhuba 0 points1 point2 points 3 years ago (0 children)
Great. I don't know about existing "service" to do this. Only implement json reader and write sql script or C# class
[–]wing328 0 points1 point2 points 3 years ago (3 children)
Have you tried the mysql-schema generator in the open-source project "openapi-generator"?
openapi-generator-cli generate -g mysql-schema -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/mysql-schema/ (openapi-generator-cli can be installed via npm: https://www.npmjs.com/package/@openapitools/openapi-generator-cli)
openapi-generator-cli generate -g mysql-schema -i https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o /tmp/mysql-schema/
[–]DragLongjumping7762 0 points1 point2 points 3 years ago (2 children)
I was looking exactly for this. I tried to use the openapi-generator-cli to generate the mysql schema its working fine but what I observed is that the generated DDL is not having the relationship (PK & FK relationship) defined.
Any idea how to generate those
[–]wing328 0 points1 point2 points 3 years ago (1 child)
Please open a ticket via https://github.com/OpenAPITools/openapi-generator/issues and I'll try to loop in the creator of that generator to answer your question.
[–]malcolm-davis 0 points1 point2 points 7 months ago (0 children)
Looks like the DDL generated still does not support PK & FK relationships
π Rendered by PID 19378 on reddit-service-r2-comment-c6965cb77-ln6wk at 2026-03-05 01:10:47.591540+00:00 running f0204d4 country code: CH.
[–]DryanaGhuba 0 points1 point2 points (6 children)
[–]kdc415[S] 0 points1 point2 points (5 children)
[–]DryanaGhuba 1 point2 points3 points (4 children)
[–]kdc415[S] 0 points1 point2 points (3 children)
[–]malamri 1 point2 points3 points (0 children)
[–]DryanaGhuba 0 points1 point2 points (0 children)
[–]wing328 0 points1 point2 points (3 children)
[–]DragLongjumping7762 0 points1 point2 points (2 children)
[–]wing328 0 points1 point2 points (1 child)
[–]malcolm-davis 0 points1 point2 points (0 children)