# Schema validation for the Daily Challenge

**URL:** <https://forum.freecodecamp.org/t/schema-validation-for-the-daily-challenge/792051>\
**Category:** I Built This\
**Created:** [June 22, 2026, 5:40pm UTC](https://forum.freecodecamp.org/t/schema-validation-for-the-daily-challenge/792051 "2026-06-22T17:40:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kstephens6054](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/kstephens6054/32/192479_2.png) [@kstephens6054](https://forum.freecodecamp.org/u/kstephens6054)\
**Post date:** [June 22, 2026, 5:40pm UTC](https://forum.freecodecamp.org/t/schema-validation-for-the-daily-challenge/792051/1 "2026-06-22T17:40:46Z")

</div>

I came up with a fairly slick solution to the June 6 2026 Daily Challenge inspired by Joi and other schema validation tools. In Python:

```auto
def is_valid_schema(obj):
    Roles = Schema().string_enum(
        “user”, “creator”, “moderator”, “staff”, “admin”
    )
    
    UserProfile = Schema().object({
        "username": Schema().string(),
        "posts": Schema().number(),
        "verified": Schema().boolean(),
        "role": Roles,
        "supporter": Schema().optional().boolean(),
        "badges": Schema().array(Schema().string())
    })

    validator = Schema().object({
        "users": Schema().array(UserProfile)
    })

    return validator.validate(obj)

```

Implementing the Schema class is left as an exercise for the reader 😉

---

<div class="post-metadata">

**Author:** ![QuincyLarson](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/quincylarson/32/212400_2.png) [@QuincyLarson](https://forum.freecodecamp.org/u/QuincyLarson)\
**Post date:** [June 24, 2026, 2:38am UTC](https://forum.freecodecamp.org/t/schema-validation-for-the-daily-challenge/792051/2 "2026-06-24T02:38:32Z")

</div>

Sweet. Thanks for sharing your implementation here.

Are you interested in solving some more of these and sharing your solutions? I didn’t see any on your [freeCodeCamp.org/learn](http://freeCodeCamp.org/learn) profile.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/freecodecamp/original/3X/e/1/e1c433102e34b46dfaa3e15d13ab9a514b127078.svg) [@system](https://forum.freecodecamp.org/u/system)\
**Post date:** [July 22, 2026, 2:39am UTC](https://forum.freecodecamp.org/t/schema-validation-for-the-daily-challenge/792051/3 "2026-07-22T02:39:27Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
