func TestServerDiscoveryModelPOSTValidateReturnsErrorsWhenIncomplete(t *testing.T) {
	assert := test.NewAssert(t)

	server := NewServer(testJourney(), nullLogger(), &versionmock.Version{})
	defer func() {
		assert.NoError(server.Shutdown(context.TODO()))
	}()

	discoveryModel := `{}`
	expected := `{ "error":
					[
						{"key": "DiscoveryModel.Name", "error": "Field 'DiscoveryModel.Name' is required"},
						{"key": "DiscoveryModel.Description", "error": "Field 'DiscoveryModel.Description' is required"},
						{"key": "DiscoveryModel.DiscoveryVersion", "error": "Field 'DiscoveryModel.DiscoveryVersion' is required"},
						{"key": "DiscoveryModel.TokenAcquisition", "error": "Field 'DiscoveryModel.TokenAcquisition' is required"},
						{"key": "DiscoveryModel.DiscoveryItems", "error": "Field 'DiscoveryModel.DiscoveryItems' is required"}
                    ]
				}`

	code, body, headers := request(http.MethodPost, "/api/discovery-model", strings.NewReader(discoveryModel), server)

	assert.NotNil(body)
	assert.JSONEq(expected, body.String())
	assert.Equal(http.StatusBadRequest, code)
	assert.Equal(expectedJSONHeaders(), headers)
}
// /api/discovery-model/validate - POST - When incomplete model returns validation failures messages
/api/discovery-model/validate - POST - When incomplete model returns validation failures messages
// / api / discovery - model / validate - POST - When incomplete model returns validation failures messages
func TestServerDiscoveryModelPOSTValidateReturnsErrorsWhenIncomplete(t *testing.T) {
	assert := test.NewAssert(t)
	server := NewServer(testJourney(), nullLogger(), &versionmock.Version{})
	defer func() {
		assert.NoError(server.Shutdown(context.TODO()))
	}()
	discoveryModel := `{}`
	expected := `{ "error":
					[
						{"key": "DiscoveryModel.Name", "error": "Field 'DiscoveryModel.Name' is required"},
						{"key": "DiscoveryModel.Description", "error": "Field 'DiscoveryModel.Description' is required"},
						{"key": "DiscoveryModel.DiscoveryVersion", "error": "Field 'DiscoveryModel.DiscoveryVersion' is required"},
						{"key": "DiscoveryModel.TokenAcquisition", "error": "Field 'DiscoveryModel.TokenAcquisition' is required"},
						{"key": "DiscoveryModel.DiscoveryItems", "error": "Field 'DiscoveryModel.DiscoveryItems' is required"}
                    ]
				}`
	code, body, headers := request(http.MethodPost, "/api/discovery-model", strings.NewReader(discoveryModel), server)
	assert.NotNil(body)
	assert.JSONEq(expected, body.String())
	assert.Equal(http.StatusBadRequest, code)
	assert.Equal(expectedJSONHeaders(), headers)
}
func TestServerDiscoveryModelPOSTValidateReturnsErrorsWhenIncomplete ( t * testing . T ) { assert := test . NewAssert ( t ) server := NewServer ( testJourney ( ) , nullLogger ( ) , & versionmock . Version { } ) defer func ( ) { assert . NoError ( server . Shutdown ( context . TODO ( ) ) ) } ( ) discoveryModel := `{}` expected := `{ "error":
					[
						{"key": "DiscoveryModel.Name", "error": "Field 'DiscoveryModel.Name' is required"},
						{"key": "DiscoveryModel.Description", "error": "Field 'DiscoveryModel.Description' is required"},
						{"key": "DiscoveryModel.DiscoveryVersion", "error": "Field 'DiscoveryModel.DiscoveryVersion' is required"},
						{"key": "DiscoveryModel.TokenAcquisition", "error": "Field 'DiscoveryModel.TokenAcquisition' is required"},
						{"key": "DiscoveryModel.DiscoveryItems", "error": "Field 'DiscoveryModel.DiscoveryItems' is required"}
                    ]
				}` code , body , headers := request ( http . MethodPost , " " , strings . NewReader ( discoveryModel ) , server ) assert . NotNil ( body ) assert . JSONEq ( expected , body . String ( ) ) assert . Equal ( http . StatusBadRequest , code ) assert . Equal ( expectedJSONHeaders ( ) , headers ) }
api/discovery-model/validate - POST - When incomplete model returns validation failures messages
api / discovery - model / validate - POST - When incomplete model returns validation failures messages