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

Add validation to metadata links #1557

Merged
merged 1 commit into from Mar 8, 2017

Conversation

sonalkr132
Copy link
Member

User will see following when validation fails:

There was a problem saving your gem: Metadata ['home'] does not appear to be a valid URL

I would propose that we should add same validation to gem build command so that people don't have to wait until after gem push fails.

Contrary to existing behavior of Linkset, it will fail when empty string is used as link. I believe it was allowed for Linkset because of existing data we had. We don't need to carry over the confusion to metadata links as well. If a user doesn't intended to provide a particular type of link, they can simply not specify that key/link in their metadata spec.

Copy link
Member

@olleolleolle olleolleolle left a comment

Choose a reason for hiding this comment

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

The validation error message is shown inside brackets, which helps the reader catch an empty string.

Would link.inspect do the same service to the user?

Adding this validation on gem build would improve workflow in an important place.

@simi
Copy link
Member

simi commented Feb 5, 2017

What's the reason to use square brackets inside validation error message?

@sonalkr132
Copy link
Member Author

Would link.inspect do the same service to the user?

link is just an array of keys we will look for. Value exists in metadata[link].

What's the reason to use square brackets inside validation error message?

I want to communicate that a key of metadata hash has failed validation. It would look something like Metadata ['home'] .... Perhaps we should show invalid link as well?

@indirect
Copy link
Member

indirect commented Mar 8, 2017

I'm happy with Metadata ['home'] does not appear to be a valid URL. 👍

@indirect indirect merged commit 1077a25 into rubygems:master Mar 8, 2017
@sonalkr132 sonalkr132 deleted the metadata_validation branch March 8, 2017 06:32
homu added a commit to rubygems/rubygems that referenced this pull request Mar 8, 2017
Validate metadata link keys

# Description:

We intend to deprecate form used to edit linkset of gems. Metadata will be the only way to specify homepage, codebase, documentation, wiki, mailing list and issue tracker urls.

Related: rubygems/rubygems.org#1234
rubygems/rubygems.org#1557
# Tasks:

- [x] Describe the problem / feature
- [ ] Write tests
- [ ] Write code to solve the problem
- [ ] Get code review from coworkers / friends

I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md).
@sonalkr132 sonalkr132 added this to the Metadata milestone Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants