Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #5778: correct API with JSON parameters for directives creation&up... #702

Conversation

fanf
Copy link
Member

@fanf fanf commented Dec 8, 2014

No description provided.

private[this] def extractJsonDirectiveParam (json: JValue ): Box[Map[String,Seq[String]]] = {
json \\ "parameters" match {
case x@JObject(_) => parseSectionVal(x).map(SectionVal.toMapVariables(_))
case _ => Failure(s"Not a good value for parameter ")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't you tell which one a bad value for parameter ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@ncharles
Copy link
Member

ncharles commented Dec 9, 2014

Why is this change only in branch 3.0 ? from what I understood of the ticket, it is a bug existing in current version of the API, isn't it ?

@@ -569,9 +574,11 @@ case class RestExtractorService (
longDescription <- extractOneValueJson(json, "longDescription")()
enabled <- extractOneValueJson(json, "enabled")( convertToBoolean)
priority <- extractOneValueJson(json, "priority")(convertToInt)
parameters <- extractOneValueJson(json, "parameters")(convertToDirectiveParam)
parameters <- extractJsonDirectiveParam(json)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if we try to create a directive with no parameter, because the technique isn't expecting any ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question, it should be possible to do so.

@fanf
Copy link
Member Author

fanf commented Dec 9, 2014

That PR is not targetting the correct branch. Closing it.

@fanf fanf closed this Dec 9, 2014
@fanf
Copy link
Member Author

fanf commented Dec 9, 2014

New PR: #707

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants