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
[TypeScript][Fetch] Add interfaces option #7831
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/sh | ||
|
||
SCRIPT="$0" | ||
|
||
while [ -h "$SCRIPT" ] ; do | ||
ls=`ls -ld "$SCRIPT"` | ||
link=`expr "$ls" : '.*-> \(.*\)$'` | ||
if expr "$link" : '/.*' > /dev/null; then | ||
SCRIPT="$link" | ||
else | ||
SCRIPT=`dirname "$SCRIPT"`/"$link" | ||
fi | ||
done | ||
|
||
if [ ! -d "${APP_DIR}" ]; then | ||
APP_DIR=`dirname "$SCRIPT"`/.. | ||
APP_DIR=`cd "${APP_DIR}"; pwd` | ||
fi | ||
|
||
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" | ||
|
||
if [ ! -f "$executable" ] | ||
then | ||
mvn clean package | ||
fi | ||
|
||
# if you've executed sbt assembly previously it will use that instead. | ||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" | ||
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l typescript-fetch -o samples/client/petstore/typescript-fetch/builds/with-interfaces -D withInterfaces=true" | ||
|
||
java $JAVA_OPTS -jar $executable $ags |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -302,14 +302,48 @@ export const {{classname}}Factory = function (configuration?: Configuration, fet | |
}; | ||
}; | ||
|
||
|
||
{{#withInterfaces}} | ||
/** | ||
* {{classname}} - interface{{#description}} | ||
* {{&description}}{{/description}} | ||
* @export | ||
* @interface {{classname}} | ||
*/ | ||
export interface {{classname}}Interface { | ||
{{#operation}} | ||
/** | ||
* {{¬es}} | ||
{{#summary}} | ||
* @summary {{&summary}} | ||
{{/summary}} | ||
{{#allParams}} | ||
* @param {{=<% %>=}}{<%%dataType%%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe use triple curly braces, i.e. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did some research into this and it looks kind of ugly doing the triple brackets within Custom Delimiters. So you can also just do |
||
{{/allParams}} | ||
* @param {*} [options] Override http request option. | ||
* @throws {RequiredError} | ||
* @memberof {{classname}}Interface | ||
*/ | ||
{{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}>; | ||
|
||
{{/operation}} | ||
} | ||
{{/withInterfaces}} | ||
|
||
|
||
/** | ||
* {{classname}} - object-oriented interface{{#description}} | ||
* {{{description}}}{{/description}} | ||
* @export | ||
* @class {{classname}} | ||
* @extends {BaseAPI} | ||
*/ | ||
{{#withInterfaces}} | ||
export class {{classname}} extends BaseAPI implements {{classname}}Interface { | ||
{{/withInterfaces}} | ||
{{^withInterfaces}} | ||
export class {{classname}} extends BaseAPI { | ||
{{/withInterfaces}} | ||
{{#operation}} | ||
/** | ||
* {{¬es}} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
wwwroot/*.js | ||
node_modules | ||
typings |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Swagger Codegen Ignore | ||
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen | ||
|
||
# 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 Swagger Codgen 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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.4.0-SNAPSHOT |
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.
please add a .cmd file for windows users
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.
@macjohnny is this resolved? Are there any more updates I should do for this PR?
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.
@tsiq-jeremy the .cmd file was added, so this particular task is resolved.
so far, there are no other change requests, so maybe someone else will also approve this PR and @wing328 will eventually merge it.