Skip to content

Commit e8a83df

Browse files
authored
Add beta server stub generator for F#/Giraffe (#2802)
* Beta server stub generator for F#/Giraffe (#2705) * first commit for F#/Giraffe use CLI generator work on handlers add binding to url params add parameter declaration to handler & fix array types order models by dependency and add tests add oauth handlers add service generation add service implementation return json for map types and add all return types to service implementation pare down record types for readability move implementations to impl folder fix additional handler invocation remove logging remove open api type provider package reference add sane defaults for OAuth add readme and reorganize files for easier ignore fix oauth checks and move login to default template typedef operation body params as model add API test templates fix test templates set project & other folders when packageName is set add ignore to test pipes add ignore for oauth to hide compile warnings escape model types for generic dictionaries remove Boolean object from primitives fix handler and param templates for multiple path params remove "Model" from model module names and fix import mapping for dictionary add package name to model imports change model templates to use imports move login to CustomHandlers raise exception where oauth not properly configured allow webhost configuration from CustomHandlers remove explicit support for nullable types and render option in template instead move Cookie options to CustomHandlers add header params integrate api key provider add nullable to datetime types fix test generation and pretty up model folder add context path to handler test template dont copy spec file remove superseded copyright notices remove superseded copyright notices * remove carriage return in fsharp template * remove superseded sample output directory * fix bash build script * update generated sample * update documentation * add new file * fix compile issues
1 parent 3c8d820 commit e8a83df

File tree

65 files changed

+5725
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+5725
-0
lines changed

bin/fsharp-giraffe-server-petstore.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
echo "# START SCRIPT: $SCRIPT"
5+
6+
while [ -h "$SCRIPT" ] ; do
7+
ls=`ls -ld "$SCRIPT"`
8+
link=`expr "$ls" : '.*-> \(.*\)$'`
9+
if expr "$link" : '/.*' > /dev/null; then
10+
SCRIPT="$link"
11+
else
12+
SCRIPT=`dirname "$SCRIPT"`/"$link"
13+
fi
14+
done
15+
16+
if [ ! -d "${APP_DIR}" ]; then
17+
APP_DIR=`dirname "$SCRIPT"`/..
18+
APP_DIR=`cd "${APP_DIR}"; pwd`
19+
fi
20+
21+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
22+
23+
if [ ! -f "$executable" ]
24+
then
25+
mvn clean package
26+
fi
27+
28+
# if you've executed sbt assembly previously it will use that instead.
29+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
30+
ags="generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -t modules/openapi-generator/src/main/resources/fsharp-giraffe-server -g fsharp-giraffe -o samples/server/petstore/fsharp-giraffe $@"
31+
32+
java ${JAVA_OPTS} -jar ${executable} ${ags}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8+
set ags=generate --artifact-id "fsharp-giraffe-petstore-server" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g fsharp-giraffe -o samples\server\petstore\fsharp-giraffe
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%

docs/generators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ The following generators are available:
7171
- [cpp-restbed-server](generators/cpp-restbed-server.md)
7272
- [csharp-nancyfx](generators/csharp-nancyfx.md)
7373
- [erlang-server](generators/erlang-server.md)
74+
- [fsharp-giraffe](generators/fsharp-giraffe.md)
7475
- [go-gin-server](generators/go-gin-server.md)
7576
- [go-server](generators/go-server.md)
7677
- [graphql-nodejs-express-server](generators/graphql-nodejs-express-server.md)

docs/generators/fsharp-giraffe.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
---
3+
id: generator-opts-server-fsharp-giraffe
4+
title: Config Options for fsharp-giraffe
5+
sidebar_label: fsharp-giraffe
6+
---
7+
8+
| Option | Description | Values | Default |
9+
| ------ | ----------- | ------ | ------- |
10+
|licenseUrl|The URL of the license| |http://localhost|
11+
|licenseName|The name of the license| |NoLicense|
12+
|packageCopyright|Specifies an AssemblyCopyright for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |No Copyright|
13+
|packageAuthors|Specifies Authors property in the .NET Core project file.| |OpenAPI|
14+
|packageTitle|Specifies an AssemblyTitle for the .NET Framework global assembly attributes stored in the AssemblyInfo file.| |OpenAPI Library|
15+
|packageName|F# module name (convention: Title.Case).| |OpenAPI|
16+
|packageVersion|F# package version.| |1.0.0|
17+
|packageGuid|The GUID that will be associated with the C# project| |null|
18+
|sourceFolder|source folder for generated code| |OpenAPI/src|
19+
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
20+
|useDateTimeOffset|Use DateTimeOffset to model date-time properties| |false|
21+
|useCollection|Deserialize array types to Collection<T> instead of List<T>.| |false|
22+
|returnICollection|Return ICollection<T> instead of the concrete type.| |false|
23+
|useSwashbuckle|Uses the Swashbuckle.AspNetCore NuGet package for documentation.| |false|
24+
|generateBody|Generates method body.| |true|
25+
|buildTarget|Target the build for a program or library.| |program|

0 commit comments

Comments
 (0)