Skip to content

fix: fixed No deserialization found for type Uri? #426 - #498

Closed
yahu1031 wants to merge 3 commits into
serverpod:mainfrom
yahu1031:uri-deserialization-fix
Closed

yahu1031 wants to merge 3 commits into
serverpod:mainfrom
yahu1031:uri-deserialization-fix

Conversation

@yahu1031

Copy link
Copy Markdown
Contributor

Fixed #426

Pre-launch Checklist

  • I read the Contribute page and followed the process outlined there for submitting PRs.
  • This update cointains only one single feature or bug fix and nothing else. (If you are submitting multiple fixes, please make multiple PRs.)
  • I read and followed the Dart Style Guide and formatted the code with dart format.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///), and made sure that the documentation follows the same style as other Serverpod documentation. I checked spelling and grammar.
  • I added new tests to check the change I am making.
  • All existing and new tests are passing.
  • Any breaking changes are documented below.

Breaking changes

No breaking changes.

@yahu1031
yahu1031 marked this pull request as ready for review December 19, 2022 10:03

@vlidholt vlidholt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please refer to #493 to see what is required to add a new type to serialization.

Specifically:

  1. There must be tests.
  2. There must be a strategy to do serialization to the database.

@yahu1031
yahu1031 marked this pull request as draft December 19, 2022 11:53
"aString" text,
"aByteData" bytea
"aByteData" bytea,
"anUri" character varying

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This should be of type text to be consistent with other database fields. (text and varchar are interchangeable in Postgres)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Okk i will change it. Please LMK anything else.

@vlidholt

Copy link
Copy Markdown
Collaborator

@yahu1031 There is no test where the Uri is passed to the server or written to the database. That needs to be there.

@yahu1031

Copy link
Copy Markdown
Contributor Author

Yes that was pending, I'm not aware of how to implement. Will check it.

@fischerscode

Copy link
Copy Markdown
Contributor

@yahu1031 Are you still working on this? In case you want, I could also provide a PR.

#641 Might be useful for reference, but some parts (database representation is a String) don't have to be done in order to support Uris.

@yahu1031

Copy link
Copy Markdown
Contributor Author

@yahu1031 Are you still working on this? In case you want, I could also provide a PR.

#641 Might be useful for reference, but some parts (database representation is a String) don't have to be done in order to support Uris.

I'm holding this back cause, that is a very super specific case. Unless you want a Uri. But we ideally don't have such a use-case cause when we myUri.toString() it, we get the Url. And also when we work on API endpoints, We can't get Uri as result to communicate with other languages. Other than my report, I don't see this issue from any end. LMK what do you think? If you would like me to finish it off, please help me out by just supporting me to write the test cases, I'm a little bit confused.

@fischerscode

Copy link
Copy Markdown
Contributor

I don't need it in my project. I just remembered, there was one more pending type addition. I think there should be types with build in support and types with documentation support.

A type with build in support should work out of the box, with no additional work required by the developer. A type with documentation support should not be should not work out of the box, but there should be documentation how to use this type in a project using extraClasses or customConstructors. For Uri however, we'd have to add something like customSerializers, I think. One might argue, UuidValue should be a 'documented type', too.


Regarding tests, I think it would be 'enough' mirror this lines with Uri:


final id = _i1.ColumnInt('id');

final url = _i1.ColumnSerializable('url');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think a ColumnString would be better.

Change would go here.

String get columnType {
//TODO: add all suported types here
if (className == 'int') return 'ColumnInt';
if (isEnum) return 'ColumnEnum';
if (className == 'double') return 'ColumnDouble';
if (className == 'bool') return 'ColumnBool';
if (className == 'String') return 'ColumnString';
if (className == 'DateTime') return 'ColumnDateTime';
if (className == 'ByteData') return 'ColumnByteData';
if (className == 'Duration') return 'ColumnDuration';
if (className == 'UuidValue') return 'ColumnUuid';
return 'ColumnSerializable';
}

@vlidholt

vlidholt commented Mar 5, 2023

Copy link
Copy Markdown
Collaborator

This would be included with the above mentioned things fixed and most importantly, tests in place.

@yahu1031

yahu1031 commented Mar 6, 2023

Copy link
Copy Markdown
Contributor Author

Will use this PR as a ref and recreate a new PR with resolved conflicts. Closing this PR for time being.

@yahu1031 yahu1031 closed this Mar 6, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No deserialization found for type Uri?

3 participants