Code Monkey home page Code Monkey logo

net2typescript's Introduction

Net2TypeScript

.NET tool to generate TypeScript interfaces/enums from .NET assembly classes/interfaces/enums

.NET tool command

dotnet net2typescript

Avaliable arguments

-s|--settings       Path to JSON settings file that uses the settings "$schema" (see
                    schema URL below). If argument is omitted, the settings file is expected
                    to be found in the same folder as the Net2TypeScript executable with the
                    file name "settings.json".

-c|--configuration  The build configuration (Release/Debug etc).
                    Emitting this parameter, enables interpolation of $(BuildConfiguration)
                    variables in the JSON settings file's path properties.
                    This is particularily useful when you want to pick assembly files from
                    different folders dynamically for different build configurations.
                    Defaults to Debug when argument is omitted.

--*                 All global properties (of "primitive" value types) in the settings file
                    schema can be set or overriden using command line arguments as an
                    alternative to using the settings file.

-h|--help           Show this help information.

JSON schema for settings file:
https://raw.githubusercontent.com/josundt/Net2TypeScript/master/Net2TypeScript/settings.schema.json

Sample settings file

{
  "$schema": "https://raw.githubusercontent.com/josundt/Net2TypeScript/master/Net2TypeScript/settings.schema.json",
  "assemblyPaths": [
    "./bin/$(BuildConfiguration)/net6.0/My.App.Models.dll",
    "../My.App.ApiModels/bin/$(BuildConfiguration)/netstandard2.0/My.App.ApiModels.dll"
  ],
  "outputPath": "../My.App.Spa/src/models/models.ts",
  "dotNetRootNamespace": "My.App",
  "tsRootNamespace": null,
  "tsFlattenNamespaces": true,
  "classNamespaceFilter": [
    "My.App.Models*",
    "My.App.ApiModels*"
  ],
  "enumNamespaceFilter": [
    "My.App.Models*",
    "My.App.ApiModels*"
  ],
  "indent": "    ",
  "enumType": "stringIfNotFlagEnum",
  "enumFormat": "enum",
  "camelCase": true,
  "excludeClass": false,
  "excludeInterface": true,
  "nullableReferenceTypes": true,
  "namespaceOverrides": {
    "My.App.ApiModels*": {
      "nullableReferenceTypes": false
    }
  },
  "classOverrides": {
    "My.App.ApiModels.PersonLocation": {
      "extraProperties": {
        "location": "import(\"./geography-point.js\").IGeographyPoint"
      }
    }
  }
}

net2typescript's People

Contributors

josundt avatar

Stargazers

Ranga Surendra avatar Tharidu Fernando avatar

Watchers

Tharidu Fernando avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.