-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[kotlin-server] --library=ktor (barebones implementation) #7412
Conversation
The -r option passed to sed is a GNU sed option for extended regex evaluation. The -E option evaluates the same option, and is part of the POSIX standard, meaning this option is available in GNU sed as well as Apple's BSD variant. This commit removes the need for users to install gnu-sed on Mac.
This adds a very barebones implementation for a ktor server generator. This supports metrics and typed locations. All endpoins are stubbed to return HTTP/1.1 501 Not Implemented.
Options available: * featureAutoHead * featureConditionalHeaders * featureHSTS * featureCORS * featureCompression
ktor doesn't seem to explicitly accept oauth flow properties in its configuration object. This may be a blocker for 'implicit' flow definitions.
The generator still needs tests, but this adds a basic ktor generator. There are still a couple of issues that still need to be worked out.
|
ktor locations are only supported for routes with path/query parameters. Routes with body or file parameters must be declared with traditional route api. This commit also includes lambdas for simplifying processing in library-based server generator code. As an example, ktor requires lowercase http methods while spring (a potential future generator) would require an uppercase such as HttpMethod.GET. It doesn't make sense to modify these in the operations post-process method because that format wouldn't be universally desirable. The lambdas included in the KotlinServerCodegen: * lowercase: converts all text to lowercase * uppercase: converts all text to UPPERCASE * titlecase: converts words (with configurable delim) to Title Case * indented|indented_8|indented_12|indented_16: these helpers apply the same desired indent to all lines of an included fragment's text.
The last commit also includes lambdas for simplifying processing in The lambdas included in the KotlinServerCodegen:
|
* master: (133 commits) add a link to ebook (polish version) Add R namespace file (swagger-api#7467) Add Spring Petstore samples (async, java8-localdatetime) to CircleCI (swagger-api#7468) Revised core team members Ada code generator corrected: "=>" instead of "->". Fixes swagger-api#7450 (swagger-api#7456) Fixes issue swagger-api#7177 (SpringCodeGen dateLibrary "java8-localdatetime" option is ignored). (swagger-api#7178) Issue-7438 Fix that prevents generating interfaces when interfaceOnly is false. (swagger-api#7439) swagger-api#7093 - Add maven wrapper (swagger-api#7356) [csharp] Support arrays of arrays for properties and models (swagger-api#7400) [csharp] Fix ToJson to work with composition and polymorphism (swagger-api#7399) [csharp] Reference this.Configuration in client api template (swagger-api#7394) [JAX-RS][Spec] Removes throws Exception. (swagger-api#7437) Use supportsES6 flag in ts compilation for language typescript-angular (swagger-api#7408) Fix 7457: [Ada] wrong order for generated structures in *-models.ads (swagger-api#7462) Fix 7459: [Ada] wrong JSON in POST operations (swagger-api#7460) [erlang-client] Erlang request utils (swagger-api#7257) reenable pushing snapshot to maven repo Create CODE_OF_CONDUCT.md comment out update to docker image deleted unnecessary notes (swagger-api#7454) ...
) | ||
|
||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties | ||
set ags=generate --artifact-id "kotlin-petstore-server" -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l kotlin --library=ktor -o samples\server\petstore\kotlin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: -l kotlin
=> -l kotlin-server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops. thanks for catching that. I've made the change.
Change `kotlin` to `kotlin-server`
AppVeyor reports the following errors:
Please take a look when you've time. |
I noticed some errors there, but don't get them locally. Should I fix only the files in this PR or all files listed? I don't get if I changed something that has a negative impact on those unrelated files? |
Are you using JDK7 locally (which may explain why you didn't get the error in your local build)? |
Ah, no I'm not. I've been using JDK 8 since I got my new machine a few weeks ago. I didn't bother messing around with JDK 7 :] |
…codegen into ktor-server-initial * 'ktor-server-initial' of github.com:jimschubert/swagger-codegen: Update kotlin-server-petstore.bat
Looks like AppVeyor is failing on Java 8, not Java 7:
I'm still confused how other PRs are green with the same errors. For example, another PR currently open has the same missing param description for I've made those changes locally and run the javadocs:
|
PR checklist
./bin/
to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.sh
and./bin/security/{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\
.3.0.0
branch for changes related to OpenAPI spec 3.0. Default:master
.Description of the PR
This is the starter for Kotlin server generation. Initial library support is ktor.
Opening the PR for feedback and any assistance on fleshing this out is welcome.
See #6147