Skip to content

HamadTheIronside/rest-serializer-to-typescript

Repository files navigation

Rest Serializer to TypeScript

It's an app to convert a serializer to a typescript interface

How to install?

pip install rest-serializer-to-typescript

How to use it?

  1. Add rest_serializer_to_typescript to INSTALLED_APPS
  2. Add the following data to your settings.py file
REST_SERIALIZERS_TO_TYPESCRIPT = {
    "META_DATA": "rest_framework.metadata.SimpleMetadata",
    "SERIALIZERS": {
        "your_serializer_1_path": "output_1_address",
        "your_serializer_2_path": "output_2_address",
    }
}

For example:

REST_SERIALIZERS_TO_TYPESCRIPT = {
    "META_DATA": "rest_framework.metadata.SimpleMetadata",
    "SERIALIZERS": {
        "myapp.serializers": "types/myapp_types.ts",
        "custom_app.serializers": "types/custom_app_types.ts",
    }
}
  1. Run ./manage.py serializer_to_ts

About

It's an app to convert a serializer to a typescript interface

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages