All Projects → ng-alain → sts

ng-alain / sts

Licence: MIT License
Swagger to sf schema & st column in ng-alain

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to sts

nz-schema-form
ng-zorro-antd form generation based on JSON-Schema
Stars: ✭ 40 (+100%)
Mutual labels:  json-schema, ng-alain, delon
Apispec
A pluggable API specification generator. Currently supports the OpenAPI Specification (f.k.a. the Swagger specification)..
Stars: ✭ 831 (+4055%)
Mutual labels:  json-schema, swagger
Swagger Parser
Swagger 2.0 and OpenAPI 3.0 parser/validator
Stars: ✭ 710 (+3450%)
Mutual labels:  json-schema, swagger
Docless
A scala DSL to generate JSON schema and swagger documentation for your web services.
Stars: ✭ 78 (+290%)
Mutual labels:  json-schema, swagger
Datamodel Code Generator
Pydantic model generator for easy conversion of JSON, OpenAPI, JSON Schema, and YAML data sources.
Stars: ✭ 393 (+1865%)
Mutual labels:  json-schema, swagger
Spec Tools
Clojure(Script) tools for clojure.spec
Stars: ✭ 524 (+2520%)
Mutual labels:  json-schema, swagger
Fastapi
FastAPI framework, high performance, easy to learn, fast to code, ready for production
Stars: ✭ 39,588 (+197840%)
Mutual labels:  json-schema, swagger
Ajsf
Angular JSON Schema Form
Stars: ✭ 266 (+1230%)
Mutual labels:  json-schema, angular-cli
Api Development Tools
📚 A collection of useful resources for building RESTful HTTP+JSON APIs.
Stars: ✭ 2,519 (+12495%)
Mutual labels:  json-schema, swagger
openapi-schemas
JSON Schemas for every version of the OpenAPI Specification
Stars: ✭ 22 (+10%)
Mutual labels:  json-schema, swagger
Spot
Spot is a concise, developer-friendly way to describe your API contract.
Stars: ✭ 230 (+1050%)
Mutual labels:  json-schema, swagger
Ring Swagger
Swagger Spec for Clojure Web Apps
Stars: ✭ 351 (+1655%)
Mutual labels:  json-schema, swagger
Dtsgenerator
TypeScript d.ts file generate from JSON Schema file
Stars: ✭ 344 (+1620%)
Mutual labels:  json-schema, swagger
Full Stack Fastapi Postgresql
Full stack, modern web application generator. Using FastAPI, PostgreSQL as database, Docker, automatic HTTPS and more.
Stars: ✭ 7,635 (+38075%)
Mutual labels:  json-schema, swagger
Swagger Cli
Swagger 2.0 and OpenAPI 3.0 command-line tool
Stars: ✭ 321 (+1505%)
Mutual labels:  json-schema, swagger
Spectral
A flexible JSON/YAML linter for creating automated style guides, with baked in support for OpenAPI v2 & v3.
Stars: ✭ 876 (+4280%)
Mutual labels:  json-schema, swagger
Angular2andjavaee
This project should provide a starting point for people interested in using Angular 10 with Ivy in a Java EE environment.
Stars: ✭ 78 (+290%)
Mutual labels:  swagger, angular-cli
json-ref-resolver
[Deprecated] Recursively resolve JSON pointers and remote authorities.
Stars: ✭ 27 (+35%)
Mutual labels:  json-schema, swagger
Raml Server
run a mocked server JUST based on a RAML API's definition .. zero coding
Stars: ✭ 158 (+690%)
Mutual labels:  json-schema, swagger
Full Stack Fastapi Couchbase
Full stack, modern web application generator. Using FastAPI, Couchbase as database, Docker, automatic HTTPS and more.
Stars: ✭ 243 (+1115%)
Mutual labels:  json-schema, swagger

ng-alain-sts Build Status NPM version

Convert Swagger API to sf Schema & st columns in ng-alain projects.

如何使用

ng-alain-sts 是一个 Node 插件,你可以使用命令行或直接调用 generator 方法来获取转换后的 sf Schema 和 st 列描述。

# via npm
npm i ng-alain-sts --save-dev
# via yarn
yarn add -D ng-alain-sts

ng-alain

ng-alain-sts 是专注于 NG-ALAIN,因此在 NG-ALAIN CLI 提供一个快捷命令:

ng g ng-alain:sts

它包含 listedit 两个自定义模板,可以通过指令根据 Swagger API 接口来生成列表、编辑页。

ng g ng-alain:module trade
ng g ng-alain:tpl swagger-list list -m=trade -t=trade --swaggerPath=/pet/findByStatus

更多请参考sts插件。

命令行

ng-alain-sts -t=sf -p=/pet swagger.json

参数

参数名 类型 默认 描述
-t --type sf,st sf 指定生成类型
-p --path string - 必填 指定 paths 路径
-m --method string get 指定请求方法
-c --config string swagger-config.json 指定配置文件路径

调用

const sts = require('ng-alain-sts/src/generator');

await sts.generator(
  'https://petstore.swagger.io/v2/swagger.json',
  { type: 'sf' },
  { descriptionIsTitle: true }
);

配置文件

Swagger API 接口对于每一个后端语言或企业风格有着统一的编码风格、约定,如何更好的利用这些约定使生成的结构更符合当前的开发风格,从而进一步提升开发体验;配置文件给予了一些更自由空间,我们建议针对自己的接口风格定制不同的配置信息。

Config

参数 说明 类型 默认值
requestOptions Swagger JSON 文件网络请求配置项 any -
pathPrefix 路径前缀 string -
propertyMapNames 自定义属性名称映射 { [name: string]: string } { id: '编号', name: '名称' }
descriptionIsTitle 指定 descriptiontitle,并删除 description boolean true
sf sf 配置项 SFConfig -
st st 配置项 STConfig -

SFConfig

参数 说明 类型 默认值
method 指定默认方法名 string put
singleArray 由于 sf 并不支持这种类型,默认被转化为 select 小部件 SFSchema -
properties 自定义属性的 Schema PathConfig[] -
xmlBlackNames XML 属性白名单,这些信息会以优先级最高直接传递给 ui string[] -
propertyCallback 递归属性回调 (optinos: SFPropertyCallbackOptions) => void -
finishedCallback 完成时回调 (optinos: SFFinishedCallbackOptions) => void -

singleArray

单类型数组默认被转化为 select 小部件:

{
  type: 'string',
  ui: {
    widget: 'select',
    mode: 'tags',
  },
  default: null,
}

STConfig

参数 说明 类型 默认值
method 指定默认方法名 string get
properties 自定义属性的 Schema PathConfig[] -
nameToType 根据名称自定义类型 { [name: string]: STColumnType } -
xmlBlackNames XML 属性白名单,这些信息会以优先级最高直接传递给 STColumn string[] ['i18n']
propertyCallback 递归属性回调 (optinos: STPropertyCallbackOptions) => void -
finishedCallback 完成时回调 (optinos: STFinishedCallbackOptions) => void -

nameToType

定制根据名称自定义类型,默认值为:

{
  price: 'currency',
  amount: 'currency',
  num: 'number',
  count: 'number',
  avatar: 'img',
  mp: 'img',
  modified: 'date',
  created: 'date',
}

PathConfig

参数 说明 类型 默认值
name 属性名称 string -
path 指定路径,若不指定则该属性名对所有 path 有效 string -
value 值分为 SFSchemaSTColumn 类型 `SFSchema STColumn`

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].