Skip to content

Update JSON package collection models #3067

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

Merged
merged 3 commits into from
Nov 20, 2020
Merged

Conversation

yim-lee
Copy link
Contributor

@yim-lee yim-lee commented Nov 19, 2020

According to https://forums.swift.org/t/package-collection-format/42071

  • Rename summary and title to description and name, respectively
  • Add keywords to PackageCollection.Package
  • Add minimumPlatformVersions to PackageCollection.Package.Version
  • Add createdBy to PackageCollection

API models and tests are updated as well.

@@ -16,6 +16,8 @@ import struct Foundation.URL
import PackageModel
import SourceControl

fileprivate typealias JSONModel = JSONPackageCollectionModel.V1
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@tomerd
Copy link
Contributor

tomerd commented Nov 19, 2020

looks good from a quick glance. lets get #3068 and #3069 merged first as there is tiny overlap

note: need to add new files to CMakeLists in PackageCollections directory

public let _description: String?

/// An array of keywords that the collection is associated with.
public let keywords: [String]?
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this optional so it doesn't get coded at all if empty, or is there a semantic difference? (noting for example that packages below isn't optional — though admittedly we don't expect to have no packages the way there might be no keywords)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is optional so it doesn't get coded if nil and deserialization doesn't fail if the key is missing. [] still gets coded.

packages is required. Decode will fail if the key is missing or value is nil. [] will get through and we will probably need validation to trap that case.

Copy link
Contributor

Choose a reason for hiding this comment

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

The distinction between optional and required arrays makes a lot of sense. Thanks for explaining!

@tomerd
Copy link
Contributor

tomerd commented Nov 19, 2020

@yim-lee please rebase

@yim-lee
Copy link
Contributor Author

yim-lee commented Nov 19, 2020

@swift-ci please smoke test

public let _description: String?

/// An array of keywords that the collection is associated with.
public let keywords: [String]?
Copy link
Contributor

Choose a reason for hiding this comment

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

The distinction between optional and required arrays makes a lot of sense. Thanks for explaining!

@neonichu
Copy link
Contributor

What's the driver for using description? I always find it a bit overloaded, because of CustomStringConvertible and think using summary was preferable.

@yim-lee
Copy link
Contributor Author

yim-lee commented Nov 19, 2020

because of CustomStringConvertible

Yeah that was the reason I used package.summary and collection.overview instead of description at the beginning, but then these are descriptions, and calling them differently feels a little superficial. Also since we name them description in parts of the collections code I figured we should be consistent.

@neonichu
Copy link
Contributor

Also since we name them description in parts of the collections code I figured we should be consistent.

Personally, I'd prefer using something like summary throughout.

According to https://forums.swift.org/t/package-collection-format/42071

- Rename `summary` and `title` to `description` and `name`, respectively
- Add `keywords` to `PackageCollection.Package`
- Add `minimumPlatformVersions` to `PackageCollection.Package.Version`
- Add `createdBy` to `PackageCollection`

API models and tests are updated as well.
@yim-lee
Copy link
Contributor Author

yim-lee commented Nov 19, 2020

@swift-ci please smoke test

@yim-lee yim-lee merged commit ed2cb1e into swiftlang:main Nov 20, 2020
@yim-lee yim-lee deleted the collection-json branch November 20, 2020 00:50
federicobucchi pushed a commit to federicobucchi/swift-package-manager that referenced this pull request Jan 6, 2021
According to https://forums.swift.org/t/package-collection-format/42071

- Rename `title` to `name`
- Consistent naming of `collection.overview` and `package.summary` instead of `description`
- Add `keywords` to `Collection.Package`
- Add `minimumPlatformVersions` to `Collection.Package.Version`
- Add `createdBy` to `Collection`

API models and tests are updated as well.
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.

4 participants