Skip to content

apiaddicts/apigen.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🍩 ApiGen Release stability-alpha License: LGPL v3

Security Rating Maintainability Rating Coverage Lines of Code

Asp.Net microservice archetype generator in dotnet with hexagonal architecture based on an openapi document with extended annotations. This project is a wrapper of the java apigen with springboot but using dotnet and adapting some concepts due to the paradigm difference. The project is currently being developed by the CloudAPPi Services.

web web

▶️ How to start

cli dotnet

dotnet run --project ./src/Api/Api.csproj

docker

docker build -t apigen .
docker run -d -p 1000:80 --name apigen.net apigen

docker-compose

 docker-compose up --build -d

▶️ Usage

Api

if you start your application you can directly access /swagger to see the documentation. You can also call the generation endpoint directly with a curl, you have some examples in the src/Generator/Examples folder

example api-hospital.yaml

curl -X 'POST' \
  '{{url}}/generator/file' \
  -H 'accept: */*' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@<openapi-file>'

Command

Compiling the Command project or downloading the build

> apigen <openapi-path>

⏩ Next Steps

💿 ORM

The generation of the orm through special tags in openapi still generates problems but you can integrate the automatically generated code using the orm provided by entity framework. This generates the database context and the necessary entities.

dotnet tool uninstall dotnet-ef -g
dotnet tool install --global dotnet-ef
dotnet ef dbcontext scaffold <db_conexion> <driver> -o <output>

example generate with PostgreSQL

dotnet ef dbcontext scaffold "Host=<url>:<port>;Database=<db>;Username=<user>;Password=<pass>" Npgsql.EntityFrameworkCore.PostgreSQL -o Infrastructure

About

archetype generator .net microservices using openapi doc

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages