mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
chore(ui): organize generated files
This commit is contained in:
parent
16442e8f15
commit
427104f936
@ -8,11 +8,10 @@
|
||||
- [Getting the JSON with a python script](#getting-the-json-with-a-python-script)
|
||||
- [Generate the API client](#generate-the-api-client)
|
||||
- [The generated client](#the-generated-client)
|
||||
- [Fix a small issue](#fix-a-small-issue)
|
||||
|
||||
This API client is generated by an [openapi code generator](https://github.com/ferdikoomen/openapi-typescript-codegen).
|
||||
|
||||
After generation, we will need to fix a small issue.
|
||||
All files in `invokeai/frontend/web/src/services/api/` are made by the generator.
|
||||
|
||||
## Generation
|
||||
|
||||
@ -57,7 +56,7 @@ The script will output `openapi.json` in the repo root. Then we need to move it
|
||||
|
||||
```bash
|
||||
# from the repo root
|
||||
python invokeai/frontend/web/src/services/api/generate_openapi_json.py
|
||||
python invokeai/frontend/web/src/services/generate_openapi_json.py
|
||||
mv openapi.json invokeai/frontend/web/
|
||||
```
|
||||
|
||||
@ -77,37 +76,3 @@ The client will be written to `invokeai/frontend/web/services/api/`:
|
||||
- `axios` client
|
||||
- TS types
|
||||
- An easily parseable schema, which we can use to generate UI
|
||||
|
||||
## Fix a small issue
|
||||
|
||||
In `models/Graph.ts`, `edges` is not parsed correctly from the OpenAPI schema. The generator outputs:
|
||||
|
||||
```typescript
|
||||
{
|
||||
...
|
||||
edges?: Array<Array<any>>;
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
This is incorrect. It should be:
|
||||
|
||||
```typescript
|
||||
{
|
||||
...
|
||||
edges?: Array<[EdgeConnection, EdgeConnection]>;
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
That is, `edges` is an array of tuples, each consisting of two `EdgeConnections`, where the first `EdgeConnection` is the "from" node, and the second is the "to" node.
|
||||
|
||||
You will also need to import the `EdgeConnection` type:
|
||||
|
||||
```typescript
|
||||
import type { EdgeConnection } from './EdgeConnection';
|
||||
```
|
||||
|
||||
If you regenerate the client, you will need to manually fix this.
|
||||
|
||||
Hopefully we can fix the parsing of the schema in the future.
|
File diff suppressed because one or more lines are too long
1821
invokeai/frontend/web/src/services/openapi.json
Normal file
1821
invokeai/frontend/web/src/services/openapi.json
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user