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

(fix): Handle lowercase storage types in JSON payload for create cata… #1022

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kameshsampath
Copy link
Contributor

Handle lowercase storage types in JSON payload for create catalogs. This fix allows the catalog request to be of the form

{
    "catalog": {
        "name": "my_catalog",
        "type": "INTERNAL",
        "readOnly": false,
        "properties": {
            "default-base-location": "s3://mycatalogs"
        },
        "storageConfigInfo": {
            "storageType": "S3",
            "allowedLocations": ["s3://mycatalogs"]
        }
    }
}

(or)

{
    "catalog": {
        "name": "my_catalog",
        "type": "INTERNAL",
        "readOnly": false,
        "properties": {
            "default-base-location": "s3://mycatalogs"
        },
        "storageConfigInfo": {
            "storageType": "s3",
            "allowedLocations": ["s3://mycatalogs"]
        }
    }
}

And lowercase storage types will be uppercased for consistency while deser.

Fix: #996

@eric-maynard
Copy link
Contributor

It feels like we could also have this apply to other fields, like type?

Anyway, this more or less LGTM

@kameshsampath
Copy link
Contributor Author

kameshsampath commented Feb 19, 2025

It feels like we could also have this apply to other fields, like type?

Anyway, this more or less LGTM

Totally makes sense wherever possible. Adding type to be uppercase

Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that the meaning of such IDs should be altered anywhere - especially not for a single request but not others. It's quite dangerous and frankly brittle.

IDs are well-defined, I'd recommend to just use the right IDs.

@eric-maynard
Copy link
Contributor

How is this "dangerous"?

@snazy
Copy link
Member

snazy commented Feb 19, 2025

How is this "dangerous"?

It's pretty obvious that this change handles this ID-case-insensitivity only for one specific REST request, right?
It also makes assumptions, which are not set in stone.

Therefore my -1 on this change.

@eric-maynard
Copy link
Contributor

Sorry, I wasn't sure how to interpret especially not for a single request but not others. It sounds like what you mean to say is, you object to this only affecting create but not other calls? I agree with that, it should be affecting everywhere we do serde on storageType.

But what does this mean? Can you be more specific?

It also makes assumptions, which are not set in stone.

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

Successfully merging this pull request may close these issues.

Using case insensitive storage type names
4 participants