Revert "Add controller version to generated files" (#47)
This reverts commit 13d5677bf3.
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
{{ else }}{{- template "field-embed" $fv }}{{ end }}{{ end }}
|
||||
}{{ end }} `json:"{{ .JSONName }}{{ if .OmitEmpty }},omitempty{{ end }}"` {{ if .FieldValidation }}// {{ .FieldValidation }}{{ end }} {{- end }}
|
||||
// Code generated from ace.jar fields *.json files
|
||||
// Controller Version {{ .ControllerVersion }}
|
||||
// DO NOT EDIT.
|
||||
|
||||
package unifi
|
||||
|
||||
@@ -92,11 +92,10 @@ var fileReps = []replacement{
|
||||
var embedTypes bool
|
||||
|
||||
type Resource struct {
|
||||
ControllerVersion string
|
||||
StructName string
|
||||
ResourcePath string
|
||||
Types map[string]*FieldInfo
|
||||
FieldProcessor func(name string, f *FieldInfo) error
|
||||
StructName string
|
||||
ResourcePath string
|
||||
Types map[string]*FieldInfo
|
||||
FieldProcessor func(name string, f *FieldInfo) error
|
||||
}
|
||||
|
||||
type FieldInfo struct {
|
||||
@@ -110,11 +109,9 @@ type FieldInfo struct {
|
||||
CustomUnmarshalType string
|
||||
}
|
||||
|
||||
func NewResource(version string, structName string, resourcePath string) *Resource {
|
||||
func NewResource(structName string, resourcePath string) *Resource {
|
||||
baseType := NewFieldInfo(structName, resourcePath, "struct", "", false, false, "")
|
||||
resource := &Resource{
|
||||
ControllerVersion: version,
|
||||
|
||||
StructName: structName,
|
||||
ResourcePath: resourcePath,
|
||||
Types: map[string]*FieldInfo{
|
||||
@@ -301,7 +298,7 @@ func main() {
|
||||
continue
|
||||
}
|
||||
|
||||
resource := NewResource(fmt.Sprintf("v%s", unifiVersion), structName, urlPath)
|
||||
resource := NewResource(structName, urlPath)
|
||||
|
||||
switch resource.StructName {
|
||||
case "Account":
|
||||
|
||||
@@ -2,9 +2,8 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
assert "github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFieldInfoFromValidation(t *testing.T) {
|
||||
@@ -146,7 +145,7 @@ func TestResourceTypes(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("structural test", func(t *testing.T) {
|
||||
resource := NewResource("v1.1", "Struct", "path")
|
||||
resource := NewResource("Struct", "path")
|
||||
resource.FieldProcessor = expectation.FieldProcessor
|
||||
|
||||
err := resource.processJSON(([]byte)(testData))
|
||||
|
||||
Reference in New Issue
Block a user