Skip to content

Commit

Permalink
[freecodecamp]: allow + symbol in username
Browse files Browse the repository at this point in the history
  • Loading branch information
SethFalco committed Sep 13, 2021
1 parent ca63f21 commit fa747fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion services/freecodecamp/freecodecamp-points.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import Joi from 'joi'
import { metric } from '../text-formatters.js'
import { BaseJsonService, InvalidResponse, NotFound } from '../index.js'

/**
* Validates that the schema response is what we're expecting.
* The username pattern should match the freeCodeCamp repository.
*
* @see https://github.com/freeCodeCamp/freeCodeCamp/blob/main/utils/validate.js#L14
*/
const schema = Joi.object({
entities: Joi.object({
user: Joi.object()
.required()
.pattern(/^\w+$/, {
.pattern(/^[a-zA-Z0-9\-_+]*$/, {
points: Joi.number().allow(null).required(),
}),
}).optional(),
Expand Down

0 comments on commit fa747fa

Please # to comment.