Giter VIP home page Giter VIP logo

Comments (6)

iain-anderson avatar iain-anderson commented on August 22, 2024

core-metadata logs

level=ERROR ts=2019-05-02T15:23:59.724796665Z app=edgex-core-metadata source=rest_device.go:61 msg="invalid OperatingState \"\""

and returns HTTP 400 with the message

invalid OperatingState ""

from go-mod-core-contracts.

tsconn23 avatar tsconn23 commented on August 22, 2024

Related blackbox test PR edgexfoundry/blackbox-testing#207

from go-mod-core-contracts.

cloudxxx8 avatar cloudxxx8 commented on August 22, 2024

@tsconn23 this issue is blocking the Device Services working with core-metadata, including the new black box test of virtual device service. May we merge the fix made by @iain-anderson first?
add @cherrycl , @FelixTing for awareness

from go-mod-core-contracts.

badboy-huaqiao avatar badboy-huaqiao commented on August 22, 2024

@iain-anderson @tsconn23 @cloudxxx8 Replace value receiver with pointer receiver can fix this bug.

func (as *AdminState) Validate() (bool, error) {
	_, found := map[string]AdminState{"LOCKED": Locked, "UNLOCKED": Unlocked}[string(*as)]
}

see my PR-#90

from go-mod-core-contracts.

badboy-huaqiao avatar badboy-huaqiao commented on August 22, 2024

@iain-anderson @tsconn23 @cloudxxx8 I'm having the same problem. I fix invalid OperatingState "", but the problem with json formatting cascading, however, is that when adding a device, i must specify the address name or id of the device service. Now i can only remove the code of verify the addressable to add the device successfully.
if not it will return Addressable ID and Name are both blank, which is address of DeviceService.
so i have to add the field address of DS as following show:

{
	"name":"mqtt-device-01",
	"adminState":"UNLOCKED",
	"operatingState":"ENABLED",
	"protocols":{
	},
	"service":{
		"name":"localhost",
		"addressable":{
			"name":"xxx"
		}
	},
	"profile":{
		"name":"test-mqtt-profile"
	}
}

or i remove the Validate code in the Addressable model :

func (a Addressable) Validate() (bool, error) {
	if !a.isValidated {
		// if a.Id == "" && a.Name == "" {
		// 	return false, NewErrContractInvalid("Addressable ID and Name are both blank")
		// }
		return true, nil
	}
	return a.isValidated, nil
}

from go-mod-core-contracts.

tsconn23 avatar tsconn23 commented on August 22, 2024

Merged PR #86. See my comment there. In my opinion, this is indicative of a larger refactoring effort that needs to be done.

from go-mod-core-contracts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.