The Go Programming Language
› http://golang.org/
› Go Playground
Go Projects
› Revel Web Framework
livenux

golang 有好的根据 struct 生成 jsonschema 的库吗?

  •  
  •   livenux · Dec 19, 2021 · 3684 views
    This topic created in 1741 days ago, the information mentioned may be changed or developed.
    想根据 struct 生成 jsonschema 然后然后对 json 进行校验,但是看了一圈只在 github 找到一个根据 struct 生成 jsonschema 的,有点简陋。
    https://github.com/alecthomas/jsonschema
    3 replies  •  2021-12-19 21:56:30 +08:00
    dcoder
        1
    dcoder  
       Dec 19, 2021
    golang struct 能设置的部分比 jsonschema 少, 不知道能有好的这方面 lib 不.
    同关注
    janxin
        2
    janxin  
       Dec 19, 2021
    巧了,我前两天刚刚找过,作为 Schema-First 开发过度我在用这个生成 jsonschema 然后做校验

    https://pkg.go.dev/github.com/swaggest/jsonschema-go

    不过需求不一样,你可以看一下是否满足需求。另外你这样性能损耗比较大...
    kwanzaa
        3
    kwanzaa  
       Dec 19, 2021
    Copilot 一边写一边提示
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   858 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 21:44 · PVG 05:44 · LAX 14:44 · JFK 17:44
    ♥ Do have faith in what you're doing.