Describe the bug
clients generated from swagger.json with path parameters containing dots . contain errors
To Reproduce
Steps to reproduce the behavior:
{
"swagger": "2.0",
"info": {
"title": "contiamo/restful-react bug",
"version": "0.0.0"
},
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"paths": {
"/foo/{bar.baz}": {
"get": {
"operationId": "foo",
"responses": {
"200": {
"description": "A successful response."
},
"default": {
"description": "An unexpected error response."
}
},
"parameters": [
{
"name": "bar.baz",
"in": "query",
"required": false,
"type": "string"
}
]
}
}
}
}
- restful-react import --file swagger.json --output client.tsx
- That generates the following invalid tsx:
/* Generated by restful-react */
import React from "react";
import { Get, GetProps, useGet, UseGetProps } from "restful-react";
export const SPEC_VERSION = "0.0.0";
export interface FooQueryParams {
"bar.baz"?: string;
}
export type FooProps = Omit<GetProps<void, void, FooQueryParams, void>, "path">;
export const Foo = (props: FooProps) => (
<Get<void, void, FooQueryParams, void>
path={`/foo/${bar.baz}`}
{...props}
/>
);
export type UseFooProps = Omit<UseGetProps<void, void, FooQueryParams, void>, "path">;
export const useFoo = (props: UseFooProps) => useGet<void, void, FooQueryParams, void>(`/foo/${bar.baz}`, props);
Expected behavior
A valid client.tsx file
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: MacOS Big Sur 11.5.2
- Browser: Firefox
- Version 92.0.1
Additional context
Add any other context about the problem here.