Skip to content

Commit

Permalink
Add Echo.OpenAPI
Browse files Browse the repository at this point in the history
atrakic committed Jun 8, 2024
1 parent 8329d23 commit 8c00e1b
Showing 28 changed files with 1,505 additions and 45 deletions.
23 changes: 23 additions & 0 deletions .openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
22 changes: 22 additions & 0 deletions Echo.OpenAPI.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2043
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Echo.OpenAPI", "src\Echo.OpenAPI\Echo.OpenAPI.csproj", "{28CA127C-200D-4F9B-8AF4-2B1D44D71727}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{28CA127C-200D-4F9B-8AF4-2B1D44D71727}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28CA127C-200D-4F9B-8AF4-2B1D44D71727}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28CA127C-200D-4F9B-8AF4-2B1D44D71727}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28CA127C-200D-4F9B-8AF4-2B1D44D71727}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@ all:
dotnet build --configuration Release --no-restore
dotnet test --no-restore --verbosity normal

HELP_ARGS ?= "help"
HELP_ARGS ?= config-help -g aspnetcore

help: ### make help HELP_ARGS="help generate"
help: ### make help HELP_ARGS=help
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli $(HELP_ARGS)

bootstrap:
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Echo.Api - ASP.NET Core 6.0 Server
# Echo.OpenAPI - ASP.NET Core 6.0 Server

A simple API to store and retrieve messages.

@@ -44,7 +44,7 @@ build.bat
## Run in Docker

```
cd src/Echo.Api
docker build -t echo.api .
docker run -p 5000:8080 echo.api
cd src/Echo.OpenAPI
docker build -t echo.openapi .
docker run -p 5000:8080 echo.openapi
```
6 changes: 3 additions & 3 deletions build.bat
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@

@echo off

dotnet restore src\Echo.Api
dotnet build src\Echo.Api
echo Now, run the following to start the project: dotnet run -p src\Echo.Api\Echo.Api.csproj --launch-profile web.
dotnet restore src\Echo.OpenAPI
dotnet build src\Echo.OpenAPI
echo Now, run the following to start the project: dotnet run -p src\Echo.OpenAPI\Echo.OpenAPI.csproj --launch-profile web.
echo.
6 changes: 3 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
@@ -3,6 +3,6 @@
# Generated by: https://openapi-generator.tech
#

dotnet restore src/Echo.Api/ && \
dotnet build src/Echo.Api/ && \
echo "Now, run the following to start the project: dotnet run -p src/Echo.Api/Echo.Api.csproj --launch-profile web"
dotnet restore src/Echo.OpenAPI/ && \
dotnet build src/Echo.OpenAPI/ && \
echo "Now, run the following to start the project: dotnet run -p src/Echo.OpenAPI/Echo.OpenAPI.csproj --launch-profile web"
3 changes: 2 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
@@ -3,7 +3,8 @@
aspnetCoreVersion: 6.0
swashbuckleVersion: 6.4.0
packageName: Echo.OpenAPI
useSeparateModelProject: true

#useSeparateModelProject: true

# Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only) (Default: false)
useDateTimeForDate: true
35 changes: 3 additions & 32 deletions openapi.yaml
Original file line number Diff line number Diff line change
@@ -32,41 +32,12 @@ paths:
responses:
'200':
description: OK

/messages/{id}:
get:
summary: Get a message by ID
parameters:
- in: path
name: id
schema:
type: string
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Message'
put:
summary: Update a message by ID
parameters:
- in: path
name: id
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
message:
type: string
responses:
'200':
description: OK
type: array
items:
$ref: '#/components/schemas/Message'

components:
schemas:
Loading

0 comments on commit 8c00e1b

Please sign in to comment.