Skip to content

Latest commit

 

History

History
57 lines (37 loc) · 1.28 KB

README.md

File metadata and controls

57 lines (37 loc) · 1.28 KB

GoDoc

glTF

Struct for marshaling and unmarshaling glTF

go get github.com/sturfeeinc/glTF/model

It's autogenerated code from official work group's specs. Don't edit it. Edit the generator

Libraries

Validation

There are not auto validation. You can use validator.v9 explicitly before json.Marshal.

package main

import (
	"encoding/json"
	"github.com/sturfeeinc/glTF/model"
	"gopkg.in/go-playground/validator.v9"
)

func main() {

	validate := validator.New()

	gltf := glTF{}

	// ...

	err := validate.Struct(gltf)
	if err != nil {
		// handling
	}
	res, err := json.Marshal(gltf)
	println(res)
}

I thought about realization of strict validation in MarshalJSON and UnmarshalJSON for every struct. But for now it will to much complex.

Authors