Skip to content

apiaddicts/apigen.net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿฉ Apigen Release stability-alpha Swagger License: LGPL v3

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 :octocat: 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 ๐Ÿ“ง devrel@apiaddicts.org

Twitter Discord LinkedIn Facebook YouTube

๐Ÿ™Œ Join the Apigen Adopters list

๐Ÿ“ข 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

๐Ÿ‘ฉ๐Ÿฝโ€๐Ÿ’ป Contribute to ApiAddicts

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! ๐Ÿš€

"Buy Me A Coffee"

๐Ÿ“‘ Getting started

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

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

example api-hospital.yaml

curl -X 'POST' \
  '{{url}}/generator/file' \
  -H 'accept: */*' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@api-hospital.yaml'

๐Ÿ’š Status

๐Ÿงฑ Feature

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 ๐Ÿšจ

๐Ÿ” Standard Search

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 ๐Ÿšจ

๐ŸŽฒ Samples

๐Ÿ”Ž Search operations

json body for search queries for the openapi api-hospital.yaml provided in the examples. โš ๏ธ don't work with lists.

EQ

{
    "filter": {
        "operation": "EQ",
        "values": [
            {
                "property": "cause",
                "value": "Crocodile bite"
            }
        ]
    }
}

variant LIKE with OR

{
    "filter": {
        "operation": "OR",
        "values": [
            {
                "filter": {
                    "operation": "LIKE",
                    "values": [
                        {
                            "property": "cause",
                            "value": "Cro%"
                        }
                    ]
                }
            },
            {
                "filter": {
                    "operation": "ILIKE",
                    "values": [
                        {
                            "property": "room.code",
                            "value": "%2"
                        }
                    ]
                }
            }
        ]
    }
}

BETWEEN

{
    "filter": {
        "operation": "BETWEEN",
        "values": [
            {
                "property": "entrydate",
                "value": ["2021-01-01", "2021-08-30"]
            }
        ]
    }
}

variant IN with AND

{
    "filter": {
        "operation": "AND",
        "values": [
            {
                "filter": {
                    "operation": "IN",
                    "values": [
                        {
                            "property": "cause",
                            "value": ["Dog bite","Burn"]
                        }
                    ]
                }
            },
            {
                "filter": {
                    "operation": "IN",
                    "values": [
                        {
                            "property": "room.active",
                            "value": [true]
                        }
                    ]
                }
            }
        ]
    }
}

๐Ÿ“š TargetFramework .net 7

the libraries that extend from others are not indicated in the description

๐Ÿก apigen core libraries

Name Descripciรณn
CodegenCS Class Library and Toolkit for Code Generation using plain C#
DotNetZip Create, extract, or update zip files
OpenAPI.NET Extract raw OpenAPI JSON and YAML documents from the model
Serilog Simple .NET logging with fully-structured events support
Swashbuckle Swagger tools for documenting APIs built on ASP.NET Coreframework

โœ๏ธ libraries that the generated project has

Name Descripciรณn
AutoMapper Mapping one object to another
EntityFrameworkCore Object-database mapper
EntityFrameworkCore Dynamic Linq extensions for Microsoft.EntityFrameworkCore which adds Async support
Serilog Simple .NET logging with fully-structured events support
xUnit developer testing framework
Swashbuckle Swagger tools for documenting APIs built on ASP.NET Coreframework
Moq Moq is the most popular and friendly mocking framework for .NET

๐Ÿ’ฟ Auto 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

๐Ÿ’› Sponsors

cloudappi

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 3

  •  
  •  
  •