func (s *workItemTypeSuite) createWorkItemTypeAnimal() (http.ResponseWriter, *app.WorkItemTypeSingle) {

	// Create an enumeration of animal names
	typeStrings := []string{"elephant", "blue whale", "Tyrannosaurus rex"}

	// Convert string slice to slice of interface{} in O(n) time.
	typeEnum := make([]interface{}, len(typeStrings))
	for i := range typeStrings {
		typeEnum[i] = typeStrings[i]
	}

	// Create the type for "animal-type" field based on the enum above
	stString := "string"
	typeFieldDef := app.FieldDefinition{
		Required: true,
		Type: &app.FieldType{
			BaseType: &stString,
			Kind:     "enum",
			Values:   typeEnum,
		},
	}

	// Create the type for the "color" field
	colorFieldDef := app.FieldDefinition{
		Required: false,
		Type: &app.FieldType{
			Kind: "string",
		},
	}

	// Use the goa generated code to create a work item type
	desc := "Description for 'animal'"
	id := animalID
	reqLong := &goa.RequestData{
		Request: &http.Request{Host: "api.service.domain.org"},
	}
	spaceSelfURL := rest.AbsoluteURL(reqLong, app.SpaceHref(space.SystemSpace.String()))
	payload := app.CreateWorkitemtypePayload{
		Data: &app.WorkItemTypeData{
			Type: "workitemtypes",
			ID:   &id,
			Attributes: &app.WorkItemTypeAttributes{
				Name:        "animal",
				Description: &desc,
				Icon:        "fa-hand-lizard-o",
				Fields: map[string]*app.FieldDefinition{
					"animal_type": &typeFieldDef,
					"color":       &colorFieldDef,
				},
			},
			Relationships: &app.WorkItemTypeRelationships{
				Space: app.NewSpaceRelation(space.SystemSpace, spaceSelfURL),
			},
		},
	}

	s.T().Log("Creating 'animal' work item type...")
	responseWriter, wi := test.CreateWorkitemtypeCreated(s.T(), nil, nil, s.typeCtrl, space.SystemSpace.String(), &payload)
	require.NotNil(s.T(), wi)
	require.NotNil(s.T(), wi.Data)
	require.NotNil(s.T(), wi.Data.ID)
	require.True(s.T(), uuid.Equal(animalID, *wi.Data.ID))
	s.T().Log("'animal' work item type created.")
	return responseWriter, wi
}
// createWorkItemTypeAnimal defines a work item type "animal" that consists of
// two fields ("animal-type" and "color"). The type is mandatory but the color is not.
createWorkItemTypeAnimal defines a work item type "animal" that consists of
two fields ("animal-type" and "color"). The type is mandatory but the color is not.
// createWorkItemTypeAnimal defines a work item type " animal " that consists of // two fields ( " animal - type " and " color " ) . The type is mandatory but the color is not .
func (s *workItemTypeSuite) createWorkItemTypeAnimal() (http.ResponseWriter, *app.WorkItemTypeSingle) {
	typeStrings := []string{"elephant", "blue whale", "Tyrannosaurus rex"}
	typeEnum := make([]interface{}, len(typeStrings))
	for i := range typeStrings {
		typeEnum[i] = typeStrings[i]
	}
	stString := "string"
	typeFieldDef := app.FieldDefinition{
		Required: true,
		Type: &app.FieldType{
			BaseType: &stString,
			Kind:     "enum",
			Values:   typeEnum,
		},
	}
	colorFieldDef := app.FieldDefinition{
		Required: false,
		Type: &app.FieldType{
			Kind: "string",
		},
	}
	desc := "Description for 'animal'"
	id := animalID
	reqLong := &goa.RequestData{
		Request: &http.Request{Host: "api.service.domain.org"},
	}
	spaceSelfURL := rest.AbsoluteURL(reqLong, app.SpaceHref(space.SystemSpace.String()))
	payload := app.CreateWorkitemtypePayload{
		Data: &app.WorkItemTypeData{
			Type: "workitemtypes",
			ID:   &id,
			Attributes: &app.WorkItemTypeAttributes{
				Name:        "animal",
				Description: &desc,
				Icon:        "fa-hand-lizard-o",
				Fields: map[string]*app.FieldDefinition{
					"animal_type": &typeFieldDef,
					"color":       &colorFieldDef,
				},
			},
			Relationships: &app.WorkItemTypeRelationships{
				Space: app.NewSpaceRelation(space.SystemSpace, spaceSelfURL),
			},
		},
	}
	s.T().Log("Creating 'animal' work item type...")
	responseWriter, wi := test.CreateWorkitemtypeCreated(s.T(), nil, nil, s.typeCtrl, space.SystemSpace.String(), &payload)
	require.NotNil(s.T(), wi)
	require.NotNil(s.T(), wi.Data)
	require.NotNil(s.T(), wi.Data.ID)
	require.True(s.T(), uuid.Equal(animalID, *wi.Data.ID))
	s.T().Log("'animal' work item type created.")
	return responseWriter, wi
}
func ( s * workItemTypeSuite ) createWorkItemTypeAnimal ( ) ( http . ResponseWriter , * app . WorkItemTypeSingle ) { typeStrings := [ ] string { " " , " " , " " } typeEnum := make ( [ ] interface { } , len ( typeStrings ) ) for i := range typeStrings { typeEnum [ i ] = typeStrings [ i ] } stString := " " typeFieldDef := app . FieldDefinition { Required : true , Type : & app . FieldType { BaseType : & stString , Kind : " " , Values : typeEnum , } , } colorFieldDef := app . FieldDefinition { Required : false , Type : & app . FieldType { Kind : " " , } , } desc := " " id := animalID reqLong := & goa . RequestData { Request : & http . Request { Host : " " } , } spaceSelfURL := rest . AbsoluteURL ( reqLong , app . SpaceHref ( space . SystemSpace . String ( ) ) ) payload := app . CreateWorkitemtypePayload { Data : & app . WorkItemTypeData { Type : " " , ID : & id , Attributes : & app . WorkItemTypeAttributes { Name : " " , Description : & desc , Icon : " " , Fields : map [ string ] * app . FieldDefinition { " " : & typeFieldDef , " " : & colorFieldDef , } , } , Relationships : & app . WorkItemTypeRelationships { Space : app . NewSpaceRelation ( space . SystemSpace , spaceSelfURL ) , } , } , } s . T ( ) . Log ( " " ) responseWriter , wi := test . CreateWorkitemtypeCreated ( s . T ( ) , nil , nil , s . typeCtrl , space . SystemSpace . String ( ) , & payload ) require . NotNil ( s . T ( ) , wi ) require . NotNil ( s . T ( ) , wi . Data ) require . NotNil ( s . T ( ) , wi . Data . ID ) require . True ( s . T ( ) , uuid . Equal ( animalID , * wi . Data . ID ) ) s . T ( ) . Log ( " " ) return responseWriter , wi }
createWorkItemTypeAnimal defines a work item type "animal" that consists of
two fields ("animal-type" and "color").
createWorkItemTypeAnimal defines a work item type " animal " that consists of two fields ( " animal - type " and " color " ) .
// Create an enumeration of animal names // Convert string slice to slice of interface{} in O(n) time. // Create the type for "animal-type" field based on the enum above // Create the type for the "color" field // Use the goa generated code to create a work item type