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

[SM-1370] Update QuickType version #926

Merged
merged 4 commits into from
Jul 30, 2024
Merged

[SM-1370] Update QuickType version #926

merged 4 commits into from
Jul 30, 2024

Conversation

Thomas-Avery
Copy link
Contributor

@Thomas-Avery Thomas-Avery commented Jul 24, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/SM-1370

📔 Objective

The purpose of this PR is to update theQuickType version.

Most language generated schemas were not effected.

C++

A minor change in the error message for enum parsing.

 default: throw std::runtime_error("This should not happen");

to

default: throw std::runtime_error("Unexpected value in enumeration \"[object Object]\": " + std::to_string(static_cast<int>(x)));

Go

Has several breaking changes.

omit-empty

Previously, the omit-empty feature was enabled by default.
QuickType's description: If set, all non-required objects will be tagged with ",omitempty"

For example, the SecretsSyncRequest struct LastSyncedDate is optional and uses emitempty.

type SecretsSyncRequest struct {
	// Optional date time a sync last occurred        
	LastSyncedDate                            *string `json:"lastSyncedDate,omitempty"`
	// Organization to sync secrets from              
	OrganizationID                            string  `json:"organizationId"`
}

To continue this behavior, I added and enabled it in the render options support/scripts/schemas.ts.

just-types-and-package & time

Previously, model properties that were DateTime types in Bitwarden server models were translated to Go string properties.

With this newer version of QuickType these DateTime properties are now time.Time in Go.
This required changes to the Sync function languages/go/secrets.go.

With the just-types-and-package render option, import "time" is added to the file at the first occurrence of a time.Time property.
This is most likely a bug and causes build errors.

go % go build
# github.com/bitwarden/sdk-go
./schema.go:288:1: syntax error: imports must appear before other declarations

Removing the just-types-and-package render option fixes this problem and has the import moved to the top of the file.
This does cause adding some unnecessary marshal & un-marshal functions, that won't be used, into the schema.go file.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation
    team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link
Contributor

github-actions bot commented Jul 24, 2024

Logo
Checkmarx One – Scan Summary & Details0882cffd-ffc7-4264-bc6a-8fc850f5f723

No New Or Fixed Issues Found

Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.11%. Comparing base (dfdbf7d) to head (92a7f6e).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #926   +/-   ##
=======================================
  Coverage   58.11%   58.11%           
=======================================
  Files         194      194           
  Lines       13197    13197           
=======================================
  Hits         7670     7670           
  Misses       5527     5527           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@dani-garcia dani-garcia left a comment

Choose a reason for hiding this comment

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

LGTM

@Thomas-Avery Thomas-Avery merged commit 5572ed8 into main Jul 30, 2024
99 of 103 checks passed
@Thomas-Avery Thomas-Avery deleted the sm/sm-1370 branch July 30, 2024 23:20
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.

3 participants