diff --git a/convert.py b/convert.py new file mode 100644 index 00000000..5c0b4ab7 --- /dev/null +++ b/convert.py @@ -0,0 +1,14 @@ +import json + +with open('swagger.json', 'r') as file: + param = """{ "description": "This header identifies the call, if not passed it is self-generated. This ID is returned in the response.", "in": "header", "name": "X-Request-Id", "type": "string" }""" + response = """"X-Request-Id": { "description": "This header identifies the call", "type": "string" }""" + data = file.read().replace("\n","") + data = data.replace(param, "") + data = data.replace(response, "") + print(data) + +f = open("swagger.json", "w") +mydata = json.loads(data) +f.write(json.dumps(mydata, indent=4)) +f.close() \ No newline at end of file diff --git a/package.json b/package.json index 8fc0fe12..faad09c7 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,8 @@ "pretest": "npm-run-all envconfig", "test": "jest --coverage --ci --testResultsProcessor jest-sonar-reporter", "test:local": "jest --coverage --ci", - "generate:api": "rm -f swagger.json && wget https://raw.githubusercontent.com/pagopa/pagopa-api-config/main/openapi/swagger.json && sed -i 's/\\\\/\\\\\\\\/g' swagger.json && gen-api-models --api-spec swagger.json --no-strict --out-dir generated/api --request-types --response-decoders --client", - "macosx:generate:api": "rm -f swagger.json && wget https://raw.githubusercontent.com/pagopa/pagopa-api-config/main/openapi/swagger.json && sed -i '' 's/\\\\/\\\\\\\\/g' swagger.json && gen-api-models --api-spec swagger.json --no-strict --out-dir generated/api --request-types --response-decoders --client", + "generate:api": "rm -f swagger.json && wget https://raw.githubusercontent.com/pagopa/pagopa-api-config/main/openapi/swagger.json && sed -i 's/\\\\/\\\\\\\\/g' swagger.json && python3 ./convert.py && gen-api-models --api-spec swagger.json --no-strict --out-dir generated/api --request-types --response-decoders --client", + "macosx:generate:api": "rm -f swagger.json && wget https://raw.githubusercontent.com/pagopa/pagopa-api-config/main/openapi/swagger.json && sed -i '' 's/\\\\/\\\\\\\\/g' swagger.json && python3 ./convert.py && gen-api-models --api-spec swagger.json --no-strict --out-dir generated/api --request-types --response-decoders --client", "generate": "npm-run-all generate:*", "prettify": "prettier --write \"./**/*.{ts,tsx}\"" }, diff --git a/src/pages/brokers/BrokersPage.tsx b/src/pages/brokers/BrokersPage.tsx index e59cebdf..95679077 100644 --- a/src/pages/brokers/BrokersPage.tsx +++ b/src/pages/brokers/BrokersPage.tsx @@ -109,7 +109,7 @@ export default class BrokersPage extends React.Component { } } - deleteBroker(access_token: string, broker_code: string) { + deleteBrokerCall(access_token: string, broker_code: string) { apiClient.deleteBroker({ Authorization: `Bearer ${access_token}`, ApiKey: "", @@ -145,7 +145,7 @@ export default class BrokersPage extends React.Component { }) .then((response: any) => { if (this.state.brokerToDelete) { - this.deleteBroker(response.accessToken, this.state.brokerToDelete.broker_code); + this.deleteBrokerCall(response.accessToken, this.state.brokerToDelete.broker_code); } }); diff --git a/src/pages/stations/Station.tsx b/src/pages/stations/Station.tsx index 38ec989d..8bd75d24 100644 --- a/src/pages/stations/Station.tsx +++ b/src/pages/stations/Station.tsx @@ -35,7 +35,7 @@ export default class Station extends React.Component { }; } - getStation(code: string): void { + getStationCall(code: string): void { this.context.instance.acquireTokenSilent({ ...loginRequest, account: this.context.accounts[0] @@ -63,7 +63,7 @@ export default class Station extends React.Component { componentDidMount(): void { const code: string = this.props.match.params.code as string; this.setState({isError: false}); - this.getStation(code); + this.getStationCall(code); } render(): React.ReactNode {