-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
typescript-axios anytype is not defined (#6335)
* Include map for `AnyType` in `typescript` * Exclude `any` from the list of types extracted from `anyOf`, `allOf`, `oneOf` Exclude if there are other meaningful types * Include new scripts and `yaml` to test the new case * Execute the new sample for `typescript-axios` * Filter out only `AnyType` instead of all `any` types * Renamed and modified samples - Included more examples using `oneOf, `allOf`, `anyOf` - Includede examples when types that are translated to `any` are involved (`file`)
- Loading branch information
Showing
15 changed files
with
846 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/sh | ||
|
||
SCRIPT="$0" | ||
echo "# START SCRIPT: $SCRIPT" | ||
|
||
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/openapi-generator-cli/target/openapi-generator-cli.jar" | ||
|
||
if [ ! -f "$executable" ] | ||
then | ||
mvn -B clean package | ||
fi | ||
|
||
# if you've executed sbt assembly previously it will use that instead. | ||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties" | ||
ags="generate -i modules/openapi-generator/src/test/resources/3_0/composed-schemas.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/composed-schemas $@" | ||
|
||
java $JAVA_OPTS -jar $executable $ags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
bin/windows/typescript-axios-petstore-composed-schemas.bat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@ECHO OFF | ||
|
||
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar | ||
|
||
If Not Exist %executable% ( | ||
mvn clean package | ||
) | ||
|
||
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M | ||
|
||
echo | ||
set ags=generate -i modules\openapi-generator\src\test\resources\3_0\composed-schemas.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\composed-schemas | ||
|
||
java %JAVA_OPTS% -jar %executable% %ags% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
modules/openapi-generator/src/test/resources/3_0/composed-schemas.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
|
||
|
||
openapi: 3.0.1 | ||
info: | ||
version: 1.0.0 | ||
title: Example | ||
license: | ||
name: MIT | ||
servers: | ||
- url: http://api.example.xyz/v1 | ||
paths: | ||
/pets: | ||
patch: | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
oneOf: | ||
- $ref: '#/components/schemas/Cat' | ||
- $ref: '#/components/schemas/Dog' | ||
# This field will not match to any type. | ||
- description: Any kind of pet | ||
discriminator: | ||
propertyName: pet_type | ||
responses: | ||
'200': | ||
description: Updated | ||
|
||
/pets-filtered: | ||
patch: | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
anyOf: | ||
- $ref: '#/components/schemas/PetByAge' | ||
- $ref: '#/components/schemas/PetByType' | ||
# This field will not match to any type. | ||
- description: Any kind of filter | ||
responses: | ||
'200': | ||
description: Updated | ||
|
||
/file: | ||
post: | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
file: | ||
allOf: | ||
- type: file | ||
# This field will not match to any type. | ||
- description: The file to upload | ||
responses: | ||
'200': | ||
description: File uploaded | ||
|
||
components: | ||
schemas: | ||
Pet: | ||
type: object | ||
required: | ||
- pet_type | ||
Dog: | ||
allOf: | ||
# This field will not match to any type. | ||
- description: Dog information | ||
- $ref: '#/components/schemas/Pet' | ||
- type: object | ||
properties: | ||
bark: | ||
type: boolean | ||
breed: | ||
type: string | ||
enum: [Dingo, Husky, Retriever, Shepherd] | ||
Cat: | ||
allOf: | ||
- $ref: '#/components/schemas/Pet' | ||
- type: object | ||
properties: | ||
hunts: | ||
type: boolean | ||
age: | ||
type: integer | ||
PetByAge: | ||
type: object | ||
properties: | ||
age: | ||
type: integer | ||
nickname: | ||
type: string | ||
required: | ||
- age | ||
|
||
PetByType: | ||
type: object | ||
properties: | ||
pet_type: | ||
type: string | ||
enum: [Cat, Dog] | ||
hunts: | ||
type: boolean | ||
required: | ||
- pet_type |
4 changes: 4 additions & 0 deletions
4
samples/client/petstore/typescript-axios/builds/composed-schemas/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
wwwroot/*.js | ||
node_modules | ||
typings | ||
dist |
1 change: 1 addition & 0 deletions
1
samples/client/petstore/typescript-axios/builds/composed-schemas/.npmignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm |
23 changes: 23 additions & 0 deletions
23
samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator-ignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# OpenAPI Generator Ignore | ||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator | ||
|
||
# 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 OpenAPI Generator 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 |
1 change: 1 addition & 0 deletions
1
samples/client/petstore/typescript-axios/builds/composed-schemas/.openapi-generator/VERSION
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
5.0.0-SNAPSHOT |
Oops, something went wrong.