Skip to content

Commit

Permalink
Merge pull request #75 from BoostV/bugfix/openapi
Browse files Browse the repository at this point in the history
Bugfix/openapi
  • Loading branch information
langdal committed Jun 17, 2021
2 parents 18bae28 + 0526a7e commit c56b924
Show file tree
Hide file tree
Showing 11 changed files with 457 additions and 32 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,9 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the

## Update OpenAPI client

When the process-optimizer-api changes run the following command with the desired version tag and commit the resulting changes.

docker run --rm -it -u $(id -u ${USER}):$(id -g ${USER}) --volume $(pwd):/local openapitools/openapi-generator-cli generate --skip-validate-spec -i https://raw.githubusercontent.com/BoostV/process-optimizer-api/v0.0.1/optimizerapi/openapi/specification.yml -g typescript-fetch -o /local/openapi
When the process-optimizer-api changes, adjust the API version in the "openapi" script in package.json run the following command and commit the resulting changes.

yarn openapi
## Learn More

This project is based on Next.js and follow the project structure and conventions of that project.
Expand Down
2 changes: 1 addition & 1 deletion openapi/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.1.1-SNAPSHOT
5.1.1
8 changes: 0 additions & 8 deletions openapi/models/ExperimentOptimizerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ export interface ExperimentOptimizerConfig {
* @memberof ExperimentOptimizerConfig
*/
xi?: number;
/**
*
* @type {number}
* @memberof ExperimentOptimizerConfig
*/
yi?: number;
/**
*
* @type {Array<ExperimentOptimizerConfigSpace>}
Expand All @@ -85,7 +79,6 @@ export function ExperimentOptimizerConfigFromJSONTyped(json: any, ignoreDiscrimi
'initialPoints': !exists(json, 'initialPoints') ? undefined : json['initialPoints'],
'kappa': !exists(json, 'kappa') ? undefined : json['kappa'],
'xi': !exists(json, 'xi') ? undefined : json['xi'],
'yi': !exists(json, 'yi') ? undefined : json['yi'],
'space': !exists(json, 'space') ? undefined : ((json['space'] as Array<any>).map(ExperimentOptimizerConfigSpaceFromJSON)),
};
}
Expand All @@ -104,7 +97,6 @@ export function ExperimentOptimizerConfigToJSON(value?: ExperimentOptimizerConfi
'initialPoints': value.initialPoints,
'kappa': value.kappa,
'xi': value.xi,
'yi': value.yi,
'space': value.space === undefined ? undefined : ((value.space as Array<any>).map(ExperimentOptimizerConfigSpaceToJSON)),
};
}
Expand Down
8 changes: 8 additions & 0 deletions openapi/models/ResultResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export interface ResultResult {
* @memberof ResultResult
*/
next?: Array<number>;
/**
*
* @type {object}
* @memberof ResultResult
*/
extras?: object;
}

export function ResultResultFromJSON(json: any): ResultResult {
Expand All @@ -45,6 +51,7 @@ export function ResultResultFromJSONTyped(json: any, ignoreDiscriminator: boolea

'pickled': !exists(json, 'pickled') ? undefined : json['pickled'],
'next': !exists(json, 'next') ? undefined : json['next'],
'extras': !exists(json, 'extras') ? undefined : json['extras'],
};
}

Expand All @@ -59,6 +66,7 @@ export function ResultResultToJSON(value?: ResultResult | null): any {

'pickled': value.pickled,
'next': value.next,
'extras': value.extras,
};
}

Expand Down
7 changes: 7 additions & 0 deletions openapitools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "5.1.1"
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"test": "jest"
"test": "jest",
"openapi": "openapi-generator-cli generate --skip-validate-spec -i https://raw.githubusercontent.com/BoostV/process-optimizer-api/v1.0.1/optimizerapi/openapi/specification.yml -g typescript-fetch -o ./openapi"
},
"dependencies": {
"@material-ui/core": "^4.11.3",
Expand All @@ -21,6 +22,7 @@
"uuid": "^8.3.2"
},
"devDependencies": {
"@openapitools/openapi-generator-cli": "2.3.4",
"@testing-library/dom": "^7.29.4",
"@testing-library/jest-dom": "^5.11.9",
"@testing-library/react": "^11.2.5",
Expand Down
3 changes: 2 additions & 1 deletion pages/api/experiment/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ export default async (req: NextApiRequest, res: NextApiResponse<ExperimentType|E
id: experiment.id,
plots: json.plots && json.plots.map(p => { return {id: p.id, plot: p.plot}}),
next: json.result.next,
pickled: json.result.pickled
pickled: json.result.pickled,
extras: json.result.extras
}
res.json(result)
break
Expand Down
4 changes: 3 additions & 1 deletion reducers/reducers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ describe("experiment reducer", () => {
id: "123",
next: [],
plots: [],
pickled: "123"
pickled: "123",
extras: {}
},
dataPoints: []
}
Expand Down Expand Up @@ -235,6 +236,7 @@ describe("experiment reducer", () => {
id: "myExperiment",
next: [1,2,3,"Red"],
pickled: "pickled",
extras: {},
plots: [{id: "sample", plot: "base64encodedData"}]
}

Expand Down
3 changes: 2 additions & 1 deletion store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export const emptyExperiment: ExperimentType = {
id: "",
next: [],
plots: [],
pickled: ""
pickled: "",
extras: {}
},
dataPoints: []
}
Expand Down
3 changes: 2 additions & 1 deletion types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export type ExperimentResultType = {
id: string
plots: {id: string, plot: string}[]
next: (number|string)[],
pickled: string
pickled: string,
extras: object
}

export type Info = {
Expand Down
Loading

0 comments on commit c56b924

Please sign in to comment.