Skip to content

Commit

Permalink
feat: 支持 「pages (Page«WorkOrderDo», optional): 工单列表,」Page字段解析
Browse files Browse the repository at this point in the history
  • Loading branch information
limengke123 committed Jul 15, 2019
1 parent 09e5d28 commit d2cd414
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/core/resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Result} from 'range-parser'
// swagger文档的解析正则
const leftBrace: RegExp = /\s*(.*)\s*{\s*/g
const rightBrace: RegExp = /.*}.*/g
const bodyReg: RegExp = /^\s*(\w+)\s*\(([\[\]\w]+),?\s*(\w+)?\):?(.+)?/g
const bodyReg: RegExp = /^\s*(\w+)\s*\(([«»\][\w]+),?\s*(\w+)?\):?(.+)?/g
const arrReg: RegExp = /array\[(\w+)]$/g
// 字段修饰正则,去推测字段名对应的 mock 类型
const timeReg: RegExp = /\w*(?:[dD]ate)|(?:[tT]ime)\w*/
Expand Down Expand Up @@ -161,9 +161,7 @@ export class Receiver {
header: string = ''
result: Iresult = {}

receive (line: string): never | Receiver {
// console.log(leftBrace.test('Result«WorkOrderView» {'))
// console.log(rightBrace.test('}'))
receive (line: string): never | this {
if (leftBrace.test(line)) {
// 遇到了 {
if (this.offset !== 0) {
Expand Down

0 comments on commit d2cd414

Please sign in to comment.