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

Sushi doesn't like strings that start with a # as the first character. #392

Closed
keithboone opened this issue Apr 25, 2020 · 8 comments
Closed

Comments

@keithboone
Copy link

They work if I use """, but not "

@ngfreiter
Copy link
Contributor

The following seems to work for me:

Profile: MyPatient
Parent: Patient
* name.family = "#Hi"

Maybe it is something more specific to your use case? Do you have an example we could recreate this with?

@ngfreiter
Copy link
Contributor

@keithboone any updates on this and how we could recreate it?

@keithboone
Copy link
Author

keithboone commented May 4, 2020

Instance: states-NJ
InstanceOf: Location
Description : "Example Location for the State of New Jersey"

  • name = "# Testing Hash Mark\n## Second test"
  • id = "states-NJ"

This is a failing instance.

@ngfreiter
Copy link
Contributor

It seems like the issue is the \n, not the # at the start of the string. I haven't been able to cause an issue just using # with no \n, but the following:

Instance: states-NJ
InstanceOf: Location
Description: "nonsenese"
* name = "testing \n in this"

does cause an error. Now it seems like you can accomplish the desired goal here using a multiline string:

Instance: states-NJ
InstanceOf: Location
Description: "nonsenese"
* name = """
  testing 
  in this"""

But, which gives the output in JSON as

{
  "resourceType": "Location",
  "id": "states-NJ",
  "name": "testing \nin this"
}

But I'm not entirely sure if we are supposed to be allowing \n if someone wants to use \n instead of using a multiline string and using enter. I think @cmoesel and @mint-thompson know more about this and may have a better idea of what should be allowed and what is going on here.

@cmoesel
Copy link
Member

cmoesel commented May 4, 2020

The FHIR Shorthand specification doesn't really define any special support for characters like \n in strings. If we want to support something like this, I think we need to consider what special characters are supported and document them as such. For example \r, \n, and \t might be good candidates -- this would align well with what FHIR allows in strings (although FHIR doesn't explicitly say to use those representations of the characters).

I think this is worth considering, but we also need to think through any possible implications.

@keithboone
Copy link
Author

Since Sushi seems mostly to be focused on JSON representations, I was thinking that it should support the same escape sequences in strings that JSON supports, or at least expect it to.

@keithboone
Copy link
Author

Added to ballot comments.

@cmoesel
Copy link
Member

cmoesel commented Sep 14, 2021

Closing this as it was fixed a while back.

@cmoesel cmoesel closed this as completed Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants