Skip to content

Commit

Permalink
two fixes for [packagist] schemas (#7782)
Browse files Browse the repository at this point in the history
* never check for 'require' key in [packagist] /v badge

always use `schema`
closes #7779

* accept str '__unset' for 'require' key in [packagist] /php-v badge

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
  • Loading branch information
chris48s and repo-ranger[bot] authored Mar 28, 2022
1 parent ca1e774 commit f45d25c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 6 additions & 3 deletions services/packagist/packagist-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import { isStable, latest } from '../php-version.js'
const packageSchema = Joi.array().items(
Joi.object({
version: Joi.string().required(),
require: Joi.object({
php: Joi.string(),
}),
require: Joi.alternatives(
Joi.object({
php: Joi.string(),
}).required(),
Joi.string().valid('__unset')
),
})
)

Expand Down
3 changes: 1 addition & 2 deletions services/packagist/packagist-version.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { renderVersionBadge } from '../version.js'
import { optionalUrl } from '../validators.js'
import { redirector } from '../index.js'
import {
allVersionsSchema,
keywords,
BasePackagistService,
customServerDocumentationFragment,
Expand Down Expand Up @@ -84,7 +83,7 @@ class PackagistVersion extends BasePackagistService {
const json = await this.fetch({
user,
repo,
schema: includePrereleases ? schema : allVersionsSchema,
schema,
server,
})
const versions = json.packages[this.getPackageName(user, repo)]
Expand Down

0 comments on commit f45d25c

Please sign in to comment.