Giter Club home page Giter Club logo

Comments (5)

trevorrowe avatar trevorrowe commented on May 27, 2024

I have strong reservations against making AWS::Record case-insensitive. Both SimpleDB and DynamoDB are both case-sensitive. For this to work, the ids would have to be always normalized to lower-case strings. As support is added for custom id attributes with AWS::Record, this could cause a number of issues.

Have you considered filtering the incoming data from 3rd parties and normalizing the case as it is received from the source?

from aws-sdk-ruby.

ahannon-fiksu avatar ahannon-fiksu commented on May 27, 2024

I definitely understand your reservations, and the reasoning makes sense.

I guess my concern is that I am using HashModel, and I don't have easy control over the id. Is it guaranteed to always be lower case? I guess my concern is over this protected method, which I was planning on overriding in a subclass:

def populate_id
  @_id = UUIDTools::UUID.random_create.to_s
end

However, I don't like the idea of setting @_id in my subclass. What if we had a separate protected method, called generate_id, with the default implementation looks like this, with the populate_id changed appropriately:

protected 

def generate_id
  UUIDTools::UUID.random_create.to_s
end

def populate_id
  @_id = generate_id
end

This would allow me to override generate_id in my subclass, ensuring the same case all around?

Would you be amenable to this change?

from aws-sdk-ruby.

trevorrowe avatar trevorrowe commented on May 27, 2024

The plan was to make id a user-manageable attribute (this has not happened yet). The default randomly generated UUID is meant to simulate how a RDS can create an id, but without being monotonically increasing (this is generally a bad idea in no-sql systems).

The uuids are hexadecimal digits (0-9a-f), so it would be trivial to enforce that they are always lowercase (there is not plan to change this).

from aws-sdk-ruby.

ahannon-fiksu avatar ahannon-fiksu commented on May 27, 2024

I guess my question is this: does UUIDTools::UUID.random_create.to_s always return an all lowercase UUID? If not, I need to manage the id on my own (basically, calling @_id = UUIDTools::UUID.random_create.to_s.downcase in populate_id), which is not desirable. I can always just .downcase the incoming UUID from 3rd parties if the generated id is guaranteed to be always be downcased.

If [0-9a-f] is in fact the class of characters — and not [0-9a-fA-F] — then downcasing the id from the 3rd party will work. However, I need to be sure that is the case, either through documentation or controlling it on my end. Does this make sense?

from aws-sdk-ruby.

trevorrowe avatar trevorrowe commented on May 27, 2024

Yes, it will always return a lower case string (it will not return mixed case or upper case). Your concern does make sense. I'm going to go ahead and close this issue for now, as there doesn't appear to be anything that needs to happen in SDK code.

from aws-sdk-ruby.

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.