-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Echo.OpenAPI
- Loading branch information
Showing
40 changed files
with
1,624 additions
and
206 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,4 +43,3 @@ jobs: | |
|
||
- name: Test | ||
run: dotnet test --no-restore --verbosity normal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Echo.OpenAPI - ASP.NET Core 6.0 Server | ||
|
||
A simple API to store and retrieve messages. | ||
|
||
## Upgrade NuGet Packages | ||
|
||
NuGet packages get frequently updated. | ||
|
||
To upgrade this solution to the latest version of all NuGet packages, use the dotnet-outdated tool. | ||
|
||
|
||
Install dotnet-outdated tool: | ||
|
||
``` | ||
dotnet tool install --global dotnet-outdated-tool | ||
``` | ||
|
||
Upgrade only to new minor versions of packages | ||
|
||
``` | ||
dotnet outdated --upgrade --version-lock Major | ||
``` | ||
|
||
Upgrade to all new versions of packages (more likely to include breaking API changes) | ||
|
||
``` | ||
dotnet outdated --upgrade | ||
``` | ||
|
||
|
||
## Run | ||
|
||
Linux/OS X: | ||
|
||
``` | ||
sh build.sh | ||
``` | ||
|
||
Windows: | ||
|
||
``` | ||
build.bat | ||
``` | ||
## Run in Docker | ||
|
||
``` | ||
cd src/Echo.OpenAPI | ||
docker build -t echo.openapi . | ||
docker run -p 5000:8080 echo.openapi | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
:: Generated by: https://openapi-generator.tech | ||
:: | ||
|
||
@echo off | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Generated by: https://openapi-generator.tech | ||
# | ||
|
||
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
## docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli config-help -g aspnetcore | ||
|
||
aspnetCoreVersion: 6.0 | ||
swashbuckleVersion: 6.4.0 | ||
packageName: Echo.OpenAPI | ||
|
||
#useSeparateModelProject: true | ||
|
||
# Use DateTime to model date properties even if DateOnly supported. (.net 6.0+ only) (Default: false) | ||
useDateTimeForDate: true | ||
|
||
# Deserialize array types to Collection<T> instead of List<T>. (Default: false) | ||
# useCollection: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# https://github.com/OAI/OpenAPI-Specification/tree/main/examples/v3.0 | ||
openapi: 3.0.2 | ||
|
||
servers: | ||
- url: http://localhost:8080 | ||
|
||
info: | ||
title: Echo API | ||
version: 0.0.1 | ||
description: A simple API to store and retrieve messages. | ||
|
||
paths: | ||
/messages: | ||
post: | ||
summary: Store a new message | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/Message' | ||
responses: | ||
'200': | ||
description: OK | ||
get: | ||
summary: Search messages | ||
parameters: | ||
- in: query | ||
name: query | ||
schema: | ||
type: string | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: '#/components/schemas/Message' | ||
|
||
components: | ||
schemas: | ||
Message: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
message: | ||
type: string | ||
required: | ||
- id | ||
- message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
out="${1}" | ||
|
||
# https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/aspnetcore.md | ||
# docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli help config-help | ||
# docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli config-help -g aspnetcore | ||
|
||
spec=openapi.yaml | ||
image=openapitools/openapi-generator-cli | ||
docker pull -q "$image" | ||
|
||
docker run --rm -e CSHARP_POST_PROCESS_FILE=${CSHARP_POST_PROCESS_FILE} -v "${PWD}:/local" openapitools/openapi-generator-cli generate \ | ||
--skip-validate-spec \ | ||
--enable-post-process-file \ | ||
-c /local/config.yaml \ | ||
-i /local/"$spec" \ | ||
-g aspnetcore \ | ||
-o /local/"$out" | ||
|
||
dos2unix $(find . -type f -exec grep -I -q . {} \; -print) | ||
pre-commit run -a |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.