Skip to content

Commit 43dcdeb

Browse files
committed
update petstore sample files
1 parent 68825c5 commit 43dcdeb

File tree

5 files changed

+27
-10
lines changed

5 files changed

+27
-10
lines changed

samples/client/petstore/javascript-flowtyped/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ Module system
1515

1616
### Building
1717

18-
To build an compile the typescript sources to javascript use:
18+
To build an compile the flow typed sources to javascript use:
1919
```
2020
npm install
21+
npm run build
2122
```
2223

2324
### Publishing

samples/client/petstore/javascript-flowtyped/package.json

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,23 @@
1010
"swagger_petstore"
1111
],
1212
"license": "Unlicense",
13-
"main": "./index.js",
14-
"scripts" : {
15-
"prepublishOnly": "npm run build"
13+
"main": "./lib/index.js",
14+
"scripts": {
15+
"prepublishOnly": "npm run build",
16+
"build": "npm run build:clean && npm run build:lib && npm run build:flow",
17+
"build:clean": "rimraf lib",
18+
"build:lib": "node_modules/.bin/babel -d lib src --ignore '**/__tests__/**'",
19+
"build:flow": "flow-copy-source -v -i '**/__tests__/**' src lib"
1620
},
1721
"dependencies": {
1822
"portable-fetch": "^3.0.0"
1923
},
2024
"devDependencies": {
25+
"babel-cli": "^6.26.0",
26+
"babel-core": "^6.26.3",
27+
"babel-plugin-transform-flow-strip-types": "^6.22.0",
28+
"babel-preset-react-app": "^3.1.1",
29+
"flow-copy-source": "^1.3.0",
30+
"rimraf": "^2.6.2"
2131
}
2232
}

samples/client/petstore/javascript-flowtyped/api.js renamed to samples/client/petstore/javascript-flowtyped/src/api.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,8 @@ export type AnotherFakeApiType = {
951951
* AnotherFakeApi - factory function to inject configuration
952952
* @export
953953
*/
954-
export const AnotherFakeApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH): AnotherFakeApiType {
954+
export const AnotherFakeApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): AnotherFakeApiType {
955+
const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
955956
return {
956957
/**
957958
* To test special tags
@@ -1407,7 +1408,8 @@ export type FakeApiType = {
14071408
* FakeApi - factory function to inject configuration
14081409
* @export
14091410
*/
1410-
export const FakeApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH): FakeApiType {
1411+
export const FakeApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): FakeApiType {
1412+
const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
14111413
return {
14121414
/**
14131415
* Test serialization of outer boolean types
@@ -1612,7 +1614,8 @@ export type FakeClassnameTags123ApiType = {
16121614
* FakeClassnameTags123Api - factory function to inject configuration
16131615
* @export
16141616
*/
1615-
export const FakeClassnameTags123Api = function(configuration?: Configuration, fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH): FakeClassnameTags123ApiType {
1617+
export const FakeClassnameTags123Api = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): FakeClassnameTags123ApiType {
1618+
const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
16161619
return {
16171620
/**
16181621
* To test class name in snake case
@@ -1990,7 +1993,8 @@ export type PetApiType = {
19901993
* PetApi - factory function to inject configuration
19911994
* @export
19921995
*/
1993-
export const PetApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH): PetApiType {
1996+
export const PetApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): PetApiType {
1997+
const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
19941998
return {
19951999
/**
19962000
*
@@ -2252,7 +2256,8 @@ export type StoreApiType = {
22522256
* StoreApi - factory function to inject configuration
22532257
* @export
22542258
*/
2255-
export const StoreApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH): StoreApiType {
2259+
export const StoreApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): StoreApiType {
2260+
const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
22562261
return {
22572262
/**
22582263
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
@@ -2587,7 +2592,8 @@ export type UserApiType = {
25872592
* UserApi - factory function to inject configuration
25882593
* @export
25892594
*/
2590-
export const UserApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch, basePath: string = BASE_PATH): UserApiType {
2595+
export const UserApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): UserApiType {
2596+
const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
25912597
return {
25922598
/**
25932599
* This can only be done by the logged in user.

0 commit comments

Comments
 (0)