Giter VIP home page Giter VIP logo

code-nix's Introduction

code-nix

The code generator by templates from swagger yaml

模版文件与模版配置文件

模版文件是用于生成代码的格式化模版,通过模版引擎将元数据填入模版中,生成文件内容。模版语法与 handlebars 相同。

模版片段示例

interface {{model_name}} {
  {{#each fields}}
    {{this.field_name}} {{this.field_type}}
  {{/each}}
}

模版配置片段示例

[basic]
file_name = path/to/model/event.ts
desc = "auto generate by code-nix"

元数据片段示例

{
  "model": "Event",
  "fields": [
    {
      "field_name": "created_at",
      "field_type": "number"
    },
    {
      "field_name": "updated_at",
      "field_type": "number"
    }
  ]
}

输出文件示例

// path/to/model/event.ts 模版配置中决定文件位置
interface Event {
  created_at: number
  updated_at: number
}

code-nix's People

Contributors

wellerqu avatar

Watchers

 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.