Coder Social home page Coder Social logo

Comments (6)

fstuff avatar fstuff commented on July 20, 2024 1

PR submitted

from airtable.java.

HamzaAburaneh avatar HamzaAburaneh commented on July 20, 2024

Can you tell me how you solved this issue?

from airtable.java.

fstuff avatar fstuff commented on July 20, 2024

Hi, I don't think I did. :-)

However you could modify the Table.java class to use reflection to check for the SerializedName annotation as I indicate above. Maybe someone at sybit will make a patch to fix the issue.

from airtable.java.

stritti avatar stritti commented on July 20, 2024

Probably you could provide a PR, @fstuff ?

from airtable.java.

fstuff avatar fstuff commented on July 20, 2024

@stritti , having considered the code in question for a time, I think it should just be removed.

The function has to do with mapping Airtable column names to Java class fields. The Sybit Airtable.java library uses reflection to map airtable column names to java fields of the Table class with identical names as the column. I have determined that the warning exists because the Airtable API supports column names with virtually no limitations, while java field names are limited to what are called "java digits" and "java letters". For example, airtable column names can have whitespace and special characters such as $%^ but java field names cannot contain whitespace or most special characters. Additionally there are many java keywords that are reserved and cannot be used as the names of fields.

The Sybit Airtable.java library provides a solution where an airtable column name contains illegal characters--you can use the @@SerializedName annotation to associate a java field with an airtable column name that has illegal characters.

The warning that is the subject of my original post seems to be a half-hearted attempt to provide a warning where the supplied airtable column name contains characters that are illegal in java field names. But it only checks for whitespace (' ') and hyphen ('-'). It does not check for any of the other restrictions on java field names, nor does it check to see if the supplied key is a reserved java keyword. Therefore the way the function is written it will fail to catch many situations where a specified airtable column name contains characters that are illegal in java field names. Additionally, as indicated in my original post the code currently does not even check to see whether the SerializedName annotation is being used or not. Where the annotation is being used, there is no problem and therefore should be no warning.

In order to give proper coverage and generate a warning 100% of the time that we have an airtable column name that contains illegal characters for java fields, the check would have to be rewritten to check for all invalid characters and keywords. I am not sure that the overhead of doing so is worth it.

In consideration of this, I think it would be better to simply remove the warning and document the limitations mentioned above as part of the Table class documentation.

If you are agreeable to this I can of course submit a PR, but it would simply consist of deleting the few lines of code that log the warning.

from airtable.java.

stritti avatar stritti commented on July 20, 2024

Thank you very much for your improvement of the library.

from airtable.java.

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.