Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

237 - Add ability to clear date property #239

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

Conversation

@vijayvarmaD
Copy link
Contributor

@vijayvarmaD vijayvarmaD commented Jun 27, 2022

Updated c# from 7.3 to 8 for nullable reference type support

Description

Add ability to clear date property

Made Date Property nullable in DatePropertyValue.cs
Nullable reference type is supported from C# 8.0, so bumped it.
Didn't make DatePropertyItem.cs date property nullable as it was just used for retrieval

Fixes # (issue)
#237

Type of change

#237 - Added Feature

  • Feature

How Has This Been Tested?

#237 - Tested the library by Updating the page of a database & also compared the request body sent by library with the official api postman collection.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Updated c# from 7.3 to 8 for nullable reference type support
Copy link
Contributor

@KoditkarVedant KoditkarVedant left a comment

Choose a reason for hiding this comment

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

@vijayvarmaD can we add integration tests to make sure it is working with Notion APIs? It doesn't have to be running automatically like other test cases but we should have a way to run them manually to make sure our SDK is working as expected after the changes.

vijayvarmaD reacted with thumbs up emoji
Copy link
Contributor Author

Added the Integration Test. @KoditkarVedant, can you plz review the PR.

[JsonProperty("date")]
public Date Date { get; set; }
[JsonProperty("date",NullValueHandling=NullValueHandling.Include)]
public Date? Date { get; set; }
Copy link
Contributor

@KoditkarVedant KoditkarVedant Jul 10, 2022

Choose a reason for hiding this comment

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

I want to understand what is the reason behind adding nullable operator on a class?

Copy link
Contributor Author

@vijayvarmaD vijayvarmaD Jul 16, 2022
edited
Loading

Choose a reason for hiding this comment

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

Hi @KoditkarVedant ,

As per the issue: #237 & the official APIs, Notion API allows us to clear the Date Property completely. Instead of individually making Start Date and EndDate as null.

image

image

As per my understanding, Date class is an exact map to the API Resource Value of Date , so making it as nullable was the only way to allow clearing the date. We cannot make DatePropertyValue nullable as we still need the property id and type.

image

Copy link
Contributor

@KoditkarVedant KoditkarVedant Jul 16, 2022

Choose a reason for hiding this comment

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

@vijayvarmaD I understand but Date is a class so it can be set to null. I am not sure why we need to user C# 8 and then add ? to class?

Copy link
Contributor Author

@vijayvarmaD vijayvarmaD Jul 16, 2022

Choose a reason for hiding this comment

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

Ok

@KoditkarVedant KoditkarVedant linked an issue Jul 13, 2022 that may be closed by this pull request
Copy link
Contributor

@vijayvarmaD are you planning to re-open this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@KoditkarVedant KoditkarVedant KoditkarVedant requested changes

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /