Coder Social home page Coder Social logo

Comments (2)

rbino avatar rbino commented on May 28, 2024

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.

from astarte_core.

matt-mazzucato avatar matt-mazzucato commented on May 28, 2024

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
-
.
-.

from astarte_core.

Related Issues (8)

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.