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.
This repository is intended for community use, it can be modified and adapted without commercial use. If you need a version, support or help for your enterprise or project, please contact us 📧 [email protected]
📢 If Apigen is part of your organization's toolkit, we kindly encourage you to include your company's name in our Adopters list. 🙏 This not only significantly boosts the project's visibility and reputation but also represents a small yet impactful way to give back to the project.
Organization | Description of Use / Referenc |
---|---|
CloudAppi | Apification and generation of microservices |
Apiquality | Generation of microservices |
We're an inclusive and open community, welcoming you to join our effort to enhance ApiAddicts, and we're excited to prioritize tasks based on community input, inviting you to review and collaborate through our GitHub issue tracker.
Feel free to drop by and greet us on our GitHub discussion or Discord chat. You can also show your support by giving us some GitHub stars ⭐️, or by following us on Twitter, LinkedIn, and subscribing to our YouTube channel! 🚀
dotnet run --project ./src/Api/Api.csproj
docker build -t apigen .
docker run -d -p 1000:80 --name apigen.net apigen
docker-compose up --build -d
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 Doc/Examples/
folder
curl -X 'POST' \
'{{url}}/generator/file' \
-H 'accept: */*' \
-H 'Content-Type: multipart/form-data' \
-F '[email protected]'
The following table shows a state of the functionalities, remember that the project is currently in alpha
state and the generation of archetypes may vary and generate some errors.
Features | Status | 📜 |
---|---|---|
CRUD | Ok | ✔️ |
Expand | Ok. No depth limit | ✔️ |
Select | Ok. Needs QA | ✔️ |
Search | Some operations | |
Pagination | Ok. Not dynamic | ✔️ |
Dynamic Response | Needs definition | 🚨 |
OrderBy | Ok | ✔️ |
Control Exception | Ok. Not custom messages | ✔️ |
dBContext | Needs more testing and quality control. Only works with the 'api-hospital' example | 🚨 |
OpenApi | Needs quality control | 🚨 |
Operation | Status | 📜 |
---|---|---|
AND | Ok. Needs QA | ✔️ |
OR | Ok. Needs QA | ✔️ |
GT | Ok. Needs QA | ✔️ |
LT | Ok. Needs QA | ✔️ |
GTEQ | Ok. Needs QA | ✔️ |
LTEQ | Ok. Needs QA | ✔️ |
EQ | Ok. Needs QA | ✔️ |
SUBSTRING | Ok. Needs QA | ✔️ |
LIKE | Ok. Needs QA | ✔️ |
NLIKE | Ok. Needs QA | ✔️ |
ILIKE | Ok. Needs QA | ✔️ |
IN | Ok. Needs QA | ✔️ |
BETWEEN | Ok. Needs QA | ✔️ |
REGEXP | Not Implement | 🚨 |
json body for search queries for the openapi api-hospital.yaml
provided in the examples. ⚠️ don't work with lists.
{
"filter": {
"operation": "EQ",
"values": [
{
"property": "cause",
"value": "Crocodile bite"
}
]
}
}
{
"filter": {
"operation": "OR",
"values": [
{
"filter": {
"operation": "LIKE",
"values": [
{
"property": "cause",
"value": "Cro%"
}
]
}
},
{
"filter": {
"operation": "ILIKE",
"values": [
{
"property": "room.code",
"value": "%2"
}
]
}
}
]
}
}
{
"filter": {
"operation": "BETWEEN",
"values": [
{
"property": "entrydate",
"value": ["2021-01-01", "2021-08-30"]
}
]
}
}
{
"filter": {
"operation": "AND",
"values": [
{
"filter": {
"operation": "IN",
"values": [
{
"property": "cause",
"value": ["Dog bite","Burn"]
}
]
}
},
{
"filter": {
"operation": "IN",
"values": [
{
"property": "room.active",
"value": [true]
}
]
}
}
]
}
}
the libraries that extend from others are not indicated in the description
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