Skip to content

Beta server stub generator for F#/Giraffe #2705

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 3, 2019
Merged

Beta server stub generator for F#/Giraffe #2705

merged 5 commits into from
May 3, 2019

Conversation

nmfisher
Copy link
Contributor

PR checklist

  • [✓] Read the contribution guidelines.
  • [✓] Ran the shell script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in .\bin\windows\.
  • [] Filed the PR against the correct branch: master, 3.4.x, 4.0.x. Default: master.
  • Copied the technical committee to review the pull request if your PR is targeting a particular programming language.

Description of the PR

This is a beta server stub generator for F#/Giraffe as discussed in #2342.

Much of the OpenAPI specification is still unsupported, but this is mature enough to open up to the community for discussion/comments/contributions.

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
@wing328
Copy link
Member

wing328 commented Apr 30, 2019

@nmfisher FYI. I've removed carriage return in the template files via bdebd81 (I also make some minor enhancements to the shell script)

<Compile Include="api/params/UrlParams.fs" />
<Compile Include="api/params/QueryParams.fs" />
<Compile Include="api/params/BodyParams.fs" />
<Compile Include="api/params/HeaderParams.fs" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nmfisher Looks like these 4 files under api/params are not yet added to the project (templates)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually that directory (samples/server/petstore/fsharp-giraffe/src) was the sample output directory from an earlier revision.

The proper output directory is samples/server/petstore/fsharp-giraffe/{{packageName}} (e.g. samples/server/petstore/fsharp-giraffe/OpenAPI)

I just forgot to remove the earlier version (samples/server/petstore/fsharp-giraffe/src) from the final commit. This is OK to delete - see nmfisher@ee4672e

@nmfisher
Copy link
Contributor Author

nmfisher commented May 3, 2019

Sorry about the CRLF - will configure git/IDE to stick with LF going forward.

@wing328
Copy link
Member

wing328 commented May 3, 2019

@nmfisher no worries. We've a script to catch these CRLF as part of the CI workflow.

@wing328
Copy link
Member

wing328 commented May 3, 2019

OK. I'll test again.

If no more question from me, I'll merge it into the master to release a beta version so as to collect feedback from the community.

@wing328
Copy link
Member

wing328 commented May 3, 2019

Tests passed via https://travis-ci.org/OpenAPITools/openapi-generator/builds/527636181.

The CircleCI failure is due to the outdated doc. I'll fix it with another PR after merging this into master.
Travis failure due to connection timeout (not related to this change):

Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.184.215] failed: Read timed out

@wing328 wing328 merged commit 90e0f80 into OpenAPITools:f-sharp-server May 3, 2019
wing328 added a commit that referenced this pull request May 5, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants