# DTOgen - Data Transfer Object Generator
DTOgen is a powerful library that allows users to **effortlessly generate Data Transfer Object (DTO) classes** in multiple programming languages from YAML definitions. DTOgen aims to **simplify the process of mapping** JSON or XML data to objects, making it an excellent tool for microservices development.
With DTOgen, syncing Data Transfer Objects (DTOs) across services becomes a seamless process. Since DTOgen allows you to define DTOs in a centralized YAML file and **generates the corresponding classes in multiple programming languages**, you can ensure consistency across your microservices easily.
DTOgen is designed to handle not only simple data types but also **complex data structures** like lists and maps. With the ability to represent lists and maps in the YAML definitions, DTOgen can generate DTO classes that accurately reflect these data structures in multiple programming languages.
## Features
- Define DTOs in YAML: Users can create their Data Transfer Object definitions in a YAML file, which makes it easy to manage and understand the data structures.
- Multi-language Support: DTOgen supports generating DTO classes for three popular programming languages: Java, Python, and TypeScript. This enables seamless integration into various microservices projects.
- Simple CLI Integration: The library provides a command-line interface (CLI) tool 'dtogen', making it straightforward for users to generate DTO classes for their chosen language.
## Installation
DTOgen can be installed using pip for Python, TypeScript and Java projects.
```bash
pip install dtogen
```
## Usage
1. Create a YAML file with your DTO definitions. For example, `dto_definitions.yaml`:
```yaml
info:
name: library-dtos
version: 0.0.1
dtos:
person :
attributes :
- name : name
type : string
- name : age
type : integer
```
2. Run the 'dtogen' CLI command with the desired target language:
```bash
dtogen -i dto_definitions.yaml -o dto_directory -l java --java-package com.example.dtos
```
3. The library will generate the corresponding DTO classes in the specified output directory for the chosen language.
## Example
Given the `dto_definitions.yaml` example above, DTOgen will generate the following DTO classes for each language:
### Java
```java
public class Person {
public String name;
public int age;
}
```
### Python
```python
class Person:
name: str
age: int
```
### TypeScript
```typescript
export class Person {
name: string | undefined;
age: number | undefined;
}
```
DTOgen simplifies the process of creating Data Transfer Objects, enabling developers to focus more on building efficient microservices without worrying about complex data mapping.
Raw data
{
"_id": null,
"home_page": "https://github.com/mujdecisy/dtogen",
"name": "dtogen",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, DTO, generator",
"author": "mujdecisy",
"author_email": "mujdecisy@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/d2/ca/82d90bfde682630d8a5301872f04daee44d275fc9be8fd25b4eca6a01815/dtogen-0.0.16.tar.gz",
"platform": null,
"description": "# DTOgen - Data Transfer Object Generator\n\nDTOgen is a powerful library that allows users to **effortlessly generate Data Transfer Object (DTO) classes** in multiple programming languages from YAML definitions. DTOgen aims to **simplify the process of mapping** JSON or XML data to objects, making it an excellent tool for microservices development.\n\nWith DTOgen, syncing Data Transfer Objects (DTOs) across services becomes a seamless process. Since DTOgen allows you to define DTOs in a centralized YAML file and **generates the corresponding classes in multiple programming languages**, you can ensure consistency across your microservices easily. \n\nDTOgen is designed to handle not only simple data types but also **complex data structures** like lists and maps. With the ability to represent lists and maps in the YAML definitions, DTOgen can generate DTO classes that accurately reflect these data structures in multiple programming languages.\n\n## Features\n\n- Define DTOs in YAML: Users can create their Data Transfer Object definitions in a YAML file, which makes it easy to manage and understand the data structures.\n\n- Multi-language Support: DTOgen supports generating DTO classes for three popular programming languages: Java, Python, and TypeScript. This enables seamless integration into various microservices projects.\n\n- Simple CLI Integration: The library provides a command-line interface (CLI) tool 'dtogen', making it straightforward for users to generate DTO classes for their chosen language.\n\n## Installation\n\nDTOgen can be installed using pip for Python, TypeScript and Java projects.\n\n```bash\npip install dtogen\n```\n\n## Usage\n\n1. Create a YAML file with your DTO definitions. For example, `dto_definitions.yaml`:\n\n```yaml\ninfo:\n name: library-dtos\n version: 0.0.1\n\ndtos:\n person :\n attributes :\n - name : name\n type : string\n - name : age\n type : integer\n```\n\n2. Run the 'dtogen' CLI command with the desired target language:\n\n\n```bash\ndtogen -i dto_definitions.yaml -o dto_directory -l java --java-package com.example.dtos\n```\n\n3. The library will generate the corresponding DTO classes in the specified output directory for the chosen language.\n\n## Example\n\nGiven the `dto_definitions.yaml` example above, DTOgen will generate the following DTO classes for each language:\n\n### Java\n\n```java\npublic class Person {\n public String name;\n public int age;\n}\n```\n\n### Python\n\n```python\nclass Person:\n name: str\n age: int\n```\n\n### TypeScript\n\n```typescript\nexport class Person {\n name: string | undefined;\n age: number | undefined;\n}\n```\n\nDTOgen simplifies the process of creating Data Transfer Objects, enabling developers to focus more on building efficient microservices without worrying about complex data mapping.\n",
"bugtrack_url": null,
"license": null,
"summary": "DTO generator for Java, TypeScript, Python",
"version": "0.0.16",
"project_urls": {
"Homepage": "https://github.com/mujdecisy/dtogen"
},
"split_keywords": [
"python",
" dto",
" generator"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d2ca82d90bfde682630d8a5301872f04daee44d275fc9be8fd25b4eca6a01815",
"md5": "66172e3ebc871d77531d7c7ad3aa0967",
"sha256": "05d9a9fc3b0c7ab8c2f241c409f50b45753d0398f7896adc74cce506c7ecfe13"
},
"downloads": -1,
"filename": "dtogen-0.0.16.tar.gz",
"has_sig": false,
"md5_digest": "66172e3ebc871d77531d7c7ad3aa0967",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9547,
"upload_time": "2024-05-29T07:25:39",
"upload_time_iso_8601": "2024-05-29T07:25:39.702003Z",
"url": "https://files.pythonhosted.org/packages/d2/ca/82d90bfde682630d8a5301872f04daee44d275fc9be8fd25b4eca6a01815/dtogen-0.0.16.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-29 07:25:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mujdecisy",
"github_project": "dtogen",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "dtogen"
}