mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-10-12 09:18:20 +00:00
Docs: Content updation of Generate Typescript Types From JSON Schema (#19283)
This commit is contained in:
parent
7d05902945
commit
71b56f79f7
@ -8,18 +8,36 @@ This step-by-step guide will help you to generate typescript types from JSON sch
|
|||||||
|
|
||||||
We are using [quicktype](https://quicktype.io/) to generate types from JSON Schema.
|
We are using [quicktype](https://quicktype.io/) to generate types from JSON Schema.
|
||||||
|
|
||||||
Make sure you have `quicktype` installed if not then install it using command given below from `openmetadata` root folder.
|
## Prerequisites
|
||||||
|
|
||||||
```python
|
Ensure you have `quicktype` installed. If not, install it using the commands below.
|
||||||
|
|
||||||
|
## Steps to Generate TypeScript Types
|
||||||
|
|
||||||
|
### Step 1: Install Dependencies
|
||||||
|
|
||||||
|
Navigate to the `openmetadata-ui` directory and install dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd openmetadata-ui/src/main/resources/ui
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
### Step 2: Stage Files
|
||||||
|
|
||||||
Now go to the UI folder openmetadata-ui/src/main/resources/ui and from there run the command given below.
|
Return to the root folder, add the relevant files to the staging area, and execute the following command:
|
||||||
|
|
||||||
```python
|
```bash
|
||||||
yarn run json2ts
|
changed_files=$(git diff --cached --name-only --diff-filter=ACM | grep 'openmetadata-spec/src/main/resources/json/schema/')
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command will take some time to execute and generate types.
|
This command identifies all staged files located in the `openmetadata-spec/src/main/resources/json/schema/` path and stores the file paths in the changed_files variable.
|
||||||
|
|
||||||
After that, you can go to the generated `openmetadata-ui/src/main/resources/ui/src/generated/*` folder and see all generated types.
|
### Step 3: Generate TypeScript Types
|
||||||
|
|
||||||
|
Run the following script to generate TypeScript types for the identified JSON schema files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./openmetadata-ui/src/main/resources/ui/json2ts.sh $changed_files
|
||||||
|
```
|
||||||
|
|
||||||
|
This script processes the staged JSON schema files and generates the corresponding TypeScript types.
|
||||||
|
@ -8,18 +8,36 @@ This step-by-step guide will help you to generate typescript types from JSON sch
|
|||||||
|
|
||||||
We are using [quicktype](https://quicktype.io/) to generate types from JSON Schema.
|
We are using [quicktype](https://quicktype.io/) to generate types from JSON Schema.
|
||||||
|
|
||||||
Make sure you have `quicktype` installed if not then install it using command given below from `openmetadata` root folder.
|
## Prerequisites
|
||||||
|
|
||||||
```python
|
Ensure you have `quicktype` installed. If not, install it using the commands below.
|
||||||
|
|
||||||
|
## Steps to Generate TypeScript Types
|
||||||
|
|
||||||
|
### Step 1: Install Dependencies
|
||||||
|
|
||||||
|
Navigate to the `openmetadata-ui` directory and install dependencies:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd openmetadata-ui/src/main/resources/ui
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
### Step 2: Stage Files
|
||||||
|
|
||||||
Now go to the UI folder openmetadata-ui/src/main/resources/ui and from there run the command given below.
|
Return to the root folder, add the relevant files to the staging area, and execute the following command:
|
||||||
|
|
||||||
```python
|
```bash
|
||||||
yarn run json2ts
|
changed_files=$(git diff --cached --name-only --diff-filter=ACM | grep 'openmetadata-spec/src/main/resources/json/schema/')
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command will take some time to execute and generate types.
|
This command identifies all staged files located in the `openmetadata-spec/src/main/resources/json/schema/` path and stores the file paths in the changed_files variable.
|
||||||
|
|
||||||
After that, you can go to the generated `openmetadata-ui/src/main/resources/ui/src/generated/*` folder and see all generated types.
|
### Step 3: Generate TypeScript Types
|
||||||
|
|
||||||
|
Run the following script to generate TypeScript types for the identified JSON schema files:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./openmetadata-ui/src/main/resources/ui/json2ts.sh $changed_files
|
||||||
|
```
|
||||||
|
|
||||||
|
This script processes the staged JSON schema files and generates the corresponding TypeScript types.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user