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

org.astarte-platform.InterfaceName is not a valid interface name #7

Closed
bettio opened this issue Nov 28, 2019 · 2 comments
Closed

org.astarte-platform.InterfaceName is not a valid interface name #7

bettio opened this issue Nov 28, 2019 · 2 comments
Assignees
Labels
minor This issue causes only minor annoyance to the user needs info This issue needs further information user experience This issue is about user experience
Milestone

Comments

@bettio
Copy link
Contributor

bettio commented Nov 28, 2019

Interface name validation should allow names such as org.astarte-platform.InterfaceName.

@bettio bettio added the minor This issue causes only minor annoyance to the user label Nov 28, 2019
@bettio bettio added this to Unscheduled Backlog in Astarte Core Components via automation Nov 28, 2019
@bettio bettio moved this from Unscheduled Backlog to 0.11 To do in Astarte Core Components Nov 28, 2019
@bettio bettio added this to the v0.11 milestone Nov 28, 2019
@rbino rbino added the needs info This issue needs further information label Dec 20, 2019
@rbino
Copy link
Contributor

rbino commented Dec 20, 2019

Expanding on this a little bit.
Right now we're allowing only alphanumeric characters and . in the interface name.
To be precise, we're matching the interface name against this regex:

~r/^[a-zA-Z]+(\.[a-zA-Z0-9]+)*$/

Since CQL only accepts alpha-numeric characters and underscores in table names, and since sometimes the interface name has to be mapped onto a table name, we deal with it here mainly by lowercasing everything and replacing . with _ (plus a bunch of extra stuff that is not relevant here).

The point is, if we allow using also - in the interface name, we mainly have two choices when we have to map the interface name to a table: either we replace also - with . or we drop it alltogether.

The first will cause conflicts between, e.g., com.my.pretty.Interface and com.my-pretty.Interface, the second will cause will cause conflicts between, e.g., com.my.PrettyInterface and com.my.Pretty-Interface.

Whichever way we decide to go, this has to be documented.

@rbino rbino added the user experience This issue is about user experience label Dec 20, 2019
matt-mazzucato added a commit to matt-mazzucato/astarte_core that referenced this issue Jan 10, 2020
interface name can contain hyphens everywhere but at the beginning

Fix astarte-platform#7

Signed-off-by: Mattia Mazzucato <mattia.mazzucato@ispirata.com>
matt-mazzucato added a commit to matt-mazzucato/astarte_core that referenced this issue Jan 15, 2020
interface name can contain hyphens everywhere but at the beginning

Fix astarte-platform#7

Signed-off-by: Mattia Mazzucato <mattia.mazzucato@ispirata.com>
matt-mazzucato added a commit to matt-mazzucato/astarte_core that referenced this issue Jan 15, 2020
interface name can contain hyphens everywhere but at the beginning

Fix astarte-platform#7

Signed-off-by: Mattia Mazzucato <mattia.mazzucato@ispirata.com>
@matt-mazzucato
Copy link
Contributor

These are the examples we used to validate the regular expression for interface_name

OK:
JustInterfaceName1
JustInterfaceName
justinterfacename
com.astarte-platform.InterfaceName1
com.astarte-platform.InterfaceName
com.astarte-platform.interfacename
a.InterfaceName
com.a.InterfaceName
com.0.aa
aaa.a-.aaaaa
c0m.InterfaceName

Shouldn't be ok, but we are accepting it anyway:
com.a-.interfacename

Not ok:
com.-.InterfaceName
c-m.InterfaceName
a-.a
c-o-m.astarte-platform.interfacename
1JustInterfaceName
just-interface-name
com.astarte-platform.InterfaceName-
com.astarte-platform.InterfaceName.
-a.a
0.test.InterfaceName
0.InterfaceName
-
.
-.

matt-mazzucato added a commit to matt-mazzucato/astarte_core that referenced this issue Jan 15, 2020
interface name can contain hyphens everywhere but at the beginning

Fix astarte-platform#7

Signed-off-by: Mattia Mazzucato <mattia.mazzucato@ispirata.com>
@rbino rbino moved this from 0.11.0 To do to Review in progress in Astarte Core Components Jan 15, 2020
@bettio bettio closed this as completed in 7e1c797 Jan 22, 2020
Astarte Core Components automation moved this from Review in progress to 0.11 Done Jan 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor This issue causes only minor annoyance to the user needs info This issue needs further information user experience This issue is about user experience
Projects
No open projects
Development

No branches or pull requests

3 participants