Skip to content

Commit

Permalink
readme
Browse files Browse the repository at this point in the history
  • Loading branch information
pyramation committed May 20, 2024
1 parent affadcb commit 3978705
Showing 1 changed file with 11 additions and 51 deletions.
62 changes: 11 additions & 51 deletions packages/schema-api/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# schema-typescript
# schema-sdk

<p align="center" width="100%">
<a href="https://github.com/pyramation/schema-typescript/actions/workflows/run-tests.yaml">
<img height="20" src="https://github.com/pyramation/schema-typescript/actions/workflows/run-tests.yaml/badge.svg" />
<a href="https://github.com/pyramation/schema-sdk/actions/workflows/run-tests.yaml">
<img height="20" src="https://github.com/pyramation/schema-sdk/actions/workflows/run-tests.yaml/badge.svg" />
</a>
<a href="https://github.com/pyramation/schema-typescript/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
<a href="https://github.com/pyramation/schema-sdk/blob/main/LICENSE-MIT"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
</p>

Welcome to _schema-typescript_! This project provides robust tools for handling JSON schemas and converting them to TypeScript interfaces with ease and efficiency.
Welcome to _schema-sdk_! This project provides robust tools for handling OpenAPI schemas and converting them to TypeScript clients with ease and efficiency.

## Features

Expand All @@ -21,63 +21,23 @@ Welcome to _schema-typescript_! This project provides robust tools for handling

## Getting Started 🏁

To get started with _schema-typescript_, simply run:
To get started with _schema-sdk_, simply run:

```bash
npm install schema-typescript
npm install schema-sdk
```

## Usage 📘

Here's a quick example to show you how to convert a JSON schema into TypeScript interfaces:

```javascript
import { generateTypeScript } from 'schema-typescript';

const schema = {
"$id": "https://example.com/person.schema.json",
"$schema": "https://json-schema.org/draft-07/schema#",
"title": "Person",
"type": "object",
"properties": {
"firstName": { "type": "string" },
"pets": {
"type": "array",
"items": { "$ref": "#/$defs/pet" }
}
},
"required": ["firstName", "pets"],
"$defs": {
"pet": {
"type": "object",
"properties": {
"name": { "type": "string" },
"type": { "type": "string" }
},
"required": ["name", "type"]
}
}
};

console.log(generateTypeScript(schema));
// OUTPUT:
interface Pet {
name: string;
type: string;
}
interface Person {
firstName: string;
pets: Pet[];
}
```
## Usage

(see tests)

## Contributing 🤝

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

## Need Help?

`schema-typescript` might not work perfectly for all JSON schemas yet. We value your feedback and contributions to make it better. If you encounter any issues or have suggestions for improvements, please [let us know](https://github.com/pyramation/schema-typescript/issues).
`schema-sdk` might not work perfectly for all JSON schemas yet. We value your feedback and contributions to make it better. If you encounter any issues or have suggestions for improvements, please [let us know](https://github.com/pyramation/schema-sdk/issues).

## License 📜

Expand Down

0 comments on commit 3978705

Please sign in to comment.