fix [clojars] snapshot fallback (#3187)

* fix snapshot fallback

* fix prettier formatting

* update schema

* chore: test schema tweak

* fix schema

* Add allow null on schema
This commit is contained in:
Matthew Ratzke
2019-03-14 19:27:54 -06:00
committed by Caleb Cartwright
parent 2a9e1bbd83
commit f4ad1aa6fc
2 changed files with 5 additions and 2 deletions

View File

@@ -7,8 +7,8 @@ const { BaseJsonService } = require('..')
const clojarsSchema = Joi.object({
downloads: nonNegativeInteger,
latest_release: Joi.string().allow(null),
latest_version: Joi.string().required(),
latest_release: Joi.string().required(),
}).required()
class BaseClojarsService extends BaseJsonService {

View File

@@ -5,7 +5,10 @@ const { BaseClojarsVersionService } = require('./clojars-base')
module.exports = class ClojarsVersionRelease extends BaseClojarsVersionService {
async handle({ clojar }) {
const json = await this.fetch({ clojar })
return this.constructor.render({ clojar, version: json.latest_release })
return this.constructor.render({
clojar,
version: json.latest_release ? json.latest_release : json.latest_version,
})
}
static get route() {