Skip to content

Unsupported type: 0x8 array in unnamed BuildSource #155

@tpoxa

Description

@tpoxa

I do use Array and Hash in my payload for resource

Payload


var CreateUpdateCampaignPayload = Type("CreateUpdateCampaignPayload", func() {

	Attribute("description", String, func() {
		Example("Campaign description")
	})

	Attribute("urlTemplate", String, func() {
		Example("http://offers.com/offer1")
		Format("uri")
	})

	Attribute("defaultBid", Number, func() {
		Example(0.00150)
	})

	Attribute("dailyBalance", Number, func() {
		Example(100)
	})

	Attribute("countryBids",  HashOf(String, String), func() {
		var m = make(map[string]string);
		m["UK"] = "0.01";
		Example(m)
	})

	Attribute("dateFrom", String, func() {
		Example("2017-01-01")
	})

	Attribute("dateTo", String, func() {
		Example("2018-01-01")
	})

	Attribute("maxClicksPerIpPer24h", Integer, func() {
		Example(5)
	})

	Attribute("adult", String, func() {
		Enum("adult", "noadult", "both")
		Example("both")
	})

	Attribute("timeRange", ArrayOf(String), func() {
		Example([]string{"Mon08-24","Tue00-05","Tue08-24"})
	})

	Attribute("bidScheme", String, func() {
		Example("smart")
	})

	Attribute("sourcesWhiteList", ArrayOf(String), func() {
		Example([]string{"a", "b"})
	})

	Attribute("sourcesBlackList", ArrayOf(String), func() {
		Example([]string{"c", "d"})
	})

	Attribute("countries", ArrayOf(String), func() {
		Example([]string{"uk", "de"})
	})

	Attribute("osWhiteList", ArrayOf(String), func() {
		Example([]string{"MacOS", "Windows"})
	})

	Attribute("browsersWhiteList", ArrayOf(String), func() {
		Example([]string{"Chrome", "Safari"})
	})

	Attribute("categoriesWhiteList", ArrayOf(String), func() {
		Example([]string{"caregory1", "caregory2"})
	})
})

Resource

var _ = Resource("campaign", func() {
	DefaultMedia(Account)
	BasePath("/campaign")


	Action("create", func() {
		Routing(
			POST("/details"),
		)
		Payload(CreateUpdateCampaignPayload, func(){
			Required("description")
			Required("urlTemplate")
			Required("defaultBid")
			Required("dailyBalance")
		})
		Description("Creates new campaign")

		Response(OK, CommonResponse)
		Response(BadRequest, ErrorMedia)

	})
})

Model


var _ = StorageGroup("Storage", func() {
	Description("This is the global storage group")
	Store("mysql", gorma.MySQL, func() {
		Model("CampaignModel", func() {

			BuildsFrom(func() {
				Payload("campaign", "create")
			})
			RendersTo(CampaignMediaType)						// a Media Type definition
			Description("Campaign model")

			Field("ID", gorma.Integer, func() {    // Required for CRUD getters to take a PK argument!
				PrimaryKey()
				Description("This is the ID PK field")
			})

			Field("CreatedAt", gorma.Timestamp)
			Field("UpdatedAt", gorma.Timestamp)			 // Shown for demonstration
			Field("DeletedAt", gorma.NullableTimestamp)  // These are added by default
		})
	})
})

An error

[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0xa hash in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource
[design/db.go:13] Unsupported type: 0x8 array in unnamed BuildSource

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions