Skip to content

Commit

Permalink
NO-JIRA: Add generate Open API script (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrescrz authored Nov 22, 2024
1 parent 1888eeb commit a90e04b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
9 changes: 9 additions & 0 deletions scripts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Scripts

## General guidelines

Scripts in this folder are meant to be run from the repository base folder. Example:

```bash
./scripts/generate_openapi.sh
```
22 changes: 22 additions & 0 deletions scripts/generate_openapi.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -e

OPENAPI_YML_PATH="apps/opik-backend/target/openapi.yaml"

# Generate openapi.yaml
cd apps/opik-backend
mvn compile swagger:resolve
cd -

# Copy openapi.yaml for Fern generation
cp $OPENAPI_YML_PATH sdks/python/code_generation/fern/openapi/

# Generate Python SDK with Fern from copied openapi.yaml
cd sdks/python/code_generation
fern generate
cd -

# Format Python code
cd sdks/python
pre-commit run --all-files
cd -
2 changes: 1 addition & 1 deletion sdks/python/code_generation/fern/generators.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ groups:
version: 2.14.1
output:
location: local-file-system
path: ../sdks/python/code_generation
path: ../../src/opik/rest_api

0 comments on commit a90e04b

Please sign in to comment.