aboutsummaryrefslogtreecommitdiffstats
path: root/lua/alpha/snips/ft/yaml.lua
blob: 27704f97ef5d5c7ede7b96894e3219b467dc63d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
local ls = require("luasnip")

local snippet_from_nodes = ls.sn
local c = ls.choice_node
local t = ls.text_node
local d = ls.dynamic_node
local f = ls.function_node
local i = ls.insert_node
local fmt = require("luasnip.extras.fmt").fmt
local rep = require("luasnip.extras").rep

local M = {
    str = fmt([[{}:
  type: string
{}]], {
            i(1, ""),
            i(2, ""),
        }),
    bool = fmt([[{}:
  type: boolean
{}]], {
            i(1, ""),
            i(2, ""),
        }),
    float = fmt([[{}:
  type: number
  format: float
{}]], {
            i(1, ""),
            i(2, "")
        }),
    int = fmt([[{}:
  type: integer
{}]], {
            i(1, ""),
            i(2, "")
        }),
    id = fmt([[{}:
  type: integer
  format: int64
{}]], {
            i(1, ""),
            i(2, "")
        }),
    class = fmt([[{}:
  $ref: '#/components/schemas/{}'
{}]], {
            i(1, ""),
            i(2, ""),
            i(3, "")
        }),
    date = fmt([[{}:
  type: string
  format: date-time
{}]], {
            i(1, ""),
            i(2, "")
        }),
    arr = fmt([[{}:
  type: array
  items:
    {}
{}]], {
            i(1, ""),
            i(2, ""),
            i(3, "")
        }),
    ref = fmt([[$ref: '#/components/schemas/{}']], {i(1, "")}),
    obj = fmt([[type: object
properties:
  {}]], i(1, "")),
    aint = fmt([[{}:
  type: array
  items:
    type: int
    format: int64
{}]], {
            i(1, ""),
            i(2, ""),
        }),
    astr = fmt([[{}:
  type: array
  items:
    type: string
{}]], {
            i(1, ""),
            i(2, ""),
        }),

    mut = fmt([[{}:
    type: "{}"
    resolve: '@=mutation("App\\GraphQL\\Mutation\\{}::{}", {}, info)'
    args:
        {}
]], {
            i(1, ""),
            i(2, ""),
            i(3, ""),
            rep(1),
            i(5, ""),
            i(6, ""),
        }),

    input = fmt([[{}:
  type: input-object
  config:
    fields:
      {}
]], {
            i(1, ""),
            i(2, ""),
        }),
    f = fmt([[{}:  {{ type: "{}" }}]], {i(1, ""), i(2, "")}),
}

return M