Skip to content

Commit 84e8ae5

Browse files
c sharp server.
1 parent 3a6e598 commit 84e8ae5

7 files changed

Lines changed: 98 additions & 6 deletions

File tree

.github/workflows/stage-3-build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
steps:
6565
- name: "Checkout code"
6666
uses: actions/checkout@v4
67-
- name: "Build sdks"
67+
- name: "Build servers"
6868
uses: ./.github/actions/build-server
6969
with:
7070
version: "${{ inputs.version }}"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"generate": "npm run generate:cs --buildver=$npm_config_buildver && npm run generate:html && npm run generate:ts --buildver=$npm_config_buildver && npm run generate:python",
5050
"generate-dependencies": "npm run generate-dependencies --workspaces --if-present",
5151
"generate:cs": "./sdk/generate-cs.sh $npm_config_buildver",
52+
"generate:cs-server": "./server/generate-cs-server.sh $npm_config_buildver",
5253
"generate:html": "docker run --rm --user $(id -u) -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/specification/api/notify-supplier.yml -g html -o /local/sdk/html --skip-validate-spec",
5354
"generate:python": "docker run --rm --user $(id -u) -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/specification/api/notify-supplier.yml -g python -o /local/sdk/python --skip-validate-spec",
5455
"generate:ts": "./sdk/generate-ts.sh $npm_config_buildver",

server/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*/

server/Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
BASE_URL ?= "/"
2+
VERSION ?= ""
3+
SHELL = /bin/bash
4+
5+
build: version # Build the project artefact @Pipeline
6+
VER=$$(cat .version) && ./generate-cs-server.sh --buildver=$$VER
7+
8+
clean: # Clean-up project resources (main) @Operations
9+
rm -rf */
10+
swagger:
11+
./swagger.sh
12+
13+
version:
14+
touch _config.version.yml
15+
if [[ $(VERSION) == "" ]]; then \
16+
(cd .. && make version); \
17+
ver=$$(head -n 1 ../.version 2> /dev/null || echo unknown); \
18+
echo "version: $$ver" > _config.version.yml; \
19+
echo "$$ver" > .version; \
20+
else \
21+
echo "version: $(VERSION)" > _config.version.yml; \
22+
echo "$(VERSION)" > .version; \
23+
fi
24+
25+
echo "{ \"schemaVersion\": 1, \"label\": \"version\", \"message\": \"$$(head -n 1 .version 2> /dev/null || echo unknown)\", \"color\": \"orange\" }" > version.json

server/_config.version.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version: 1.1.1-1.1

server/generate-cs-server.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
# run this from directory above, or with npm run generate:ts from parent directory.
3+
4+
VERSION=${1:-"$(cat .version)"}
5+
6+
generate () {
7+
set -x
8+
docker run \
9+
--rm \
10+
--user $(id -u) \
11+
-v ${PWD}:/local \
12+
-e VERSION="$SHORT_VERSION" \
13+
openapitools/openapi-generator-cli \
14+
generate \
15+
-i /local/specification/api/notify-supplier.yml \
16+
-g aspnetcore \
17+
--additional-properties="aspnetCoreVersion=8.0,buildTarget=program,packageName=nhsnotifysupplierserver,packageVersion=$SHORT_VERSION,licenseId=MIT,targetFramework=net8.0" \
18+
-o /local/server/csharp-server \
19+
--skip-validate-spec
20+
set +x
21+
}
22+
23+
build () {
24+
dotnet build sdk/csharp-server/src/nhsnotifysupplierserver --configuration Release
25+
}
26+
27+
generate_nuget_version(){
28+
echo $VERSION
29+
echo $SHORT_VERSION
30+
echo $NUGET_VERSION
31+
SHORT_NUGET_VERSION="$(echo $NUGET_VERSION | rev | cut -d"." -f2- | rev)"
32+
echo $SHORT_NUGET_VERSION
33+
SHORTER_NUGET_VERSION="$(echo $SHORT_NUGET_VERSION | rev | cut -d"." -f2- | rev)"
34+
echo $SHORTER_NUGET_VERSION
35+
TEST_NUGET_VERSION="$(echo $NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
36+
TEST_NUGET_VERSION="$(echo $TEST_NUGET_VERSION | sed -E 's/.([^.]*)$/\1/')"
37+
echo $TEST_NUGET_VERSION
38+
}
39+
40+
pack(){
41+
42+
43+
generate_nuget_version
44+
45+
dotnet \
46+
pack sdk/csharp/src/nhsnotifysupplier \
47+
--configuration Release \
48+
/p:Version=${TEST_NUGET_VERSION} \
49+
--no-build \
50+
--output sdk/csharp
51+
52+
}
53+
54+
prepare(){
55+
mkdir -p sdk/nhsnotifysupplierserver
56+
echo $VERSION
57+
58+
SHORT_VERSION="$(echo $VERSION | rev | cut -d"." -f2- | rev)"
59+
echo $SHORT_VERSION
60+
61+
NUGET_VERSION="$(echo "$VERSION" | tr + .)"
62+
echo $NUGET_VERSION
63+
}
64+
65+
echo $VERSION
66+
prepare
67+
generate
68+
build
69+
#pack

specification/api/notify-supplier.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,6 @@ paths:
362362

363363
'/data/{id}':
364364
parameters:
365-
- schema:
366-
type: string
367-
name: id
368-
in: path
369-
required: true
370365
- name: id
371366
in: path
372367
description: Unique identifier of this resource

0 commit comments

Comments
 (0)