PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Applied

Validate Nested Configuration Objects

Last updated: May 2, 2026

Quick Overview

This question evaluates schema validation skills including recursive data structures, primitive and composite type checking, and structured error reporting for configuration objects, categorized under Coding & Algorithms for a Machine Learning Engineer role and focused on practical implementation.

  • hard
  • Applied
  • Coding & Algorithms
  • Machine Learning Engineer

Validate Nested Configuration Objects

Company: Applied

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: hard

Interview Round: Technical Screen

You are given a set of custom descriptor objects that define the expected schema of a configuration object. Implement a validator that checks whether an input configuration matches the descriptor. A descriptor may describe: - A primitive value, such as `string`, `number`, `boolean`, or `null`. - An object with named fields, where each field has its own descriptor. - A list, where every element must match the list element descriptor. For this problem, assume all fields defined in an object descriptor are required unless stated otherwise, and fields not present in the descriptor should be reported as unexpected. Example descriptor: ```text PersonDescriptor: name: string email: string address: AddressDescriptor AddressDescriptor: street: string city: string ``` Example input: ```json { "name": "John Adams", "email": "johnadams@gmail.com", "address": "111 street" } ``` The input is invalid because `address` is expected to be an object matching `AddressDescriptor`, but the provided value is a string. Implement: ```text validate(config, descriptor) -> list of validation errors ``` The validator should recursively check nested object descriptors and list descriptors. Each validation error should include enough information to identify where the problem occurred, such as the field path and the expected versus actual type. Your implementation should handle at least the following cases: 1. Missing required fields. 2. Unexpected extra fields. 3. Primitive type mismatches. 4. Nested object validation. 5. List validation, including invalid element types. 6. Clear error reporting for multiple errors in the same config. Do not use an external schema validation library.

Quick Answer: This question evaluates schema validation skills including recursive data structures, primitive and composite type checking, and structured error reporting for configuration objects, categorized under Coding & Algorithms for a Machine Learning Engineer role and focused on practical implementation.

Related Interview Questions

  • Merge Overlapping Collinear Segments - Applied (hard)
  • Implement a Fixed-Capacity Deque - Applied (medium)
  • Implement Nested Transactional Key-Value Store - Applied (hard)
  • Merge overlapping 2D line segments - Applied (medium)
  • Find intersection of two line segments - Applied (easy)
Applied logo
Applied
Jan 12, 2026, 12:00 AM
Machine Learning Engineer
Technical Screen
Coding & Algorithms
0
0

You are given a set of custom descriptor objects that define the expected schema of a configuration object. Implement a validator that checks whether an input configuration matches the descriptor.

A descriptor may describe:

  • A primitive value, such as string , number , boolean , or null .
  • An object with named fields, where each field has its own descriptor.
  • A list, where every element must match the list element descriptor.

For this problem, assume all fields defined in an object descriptor are required unless stated otherwise, and fields not present in the descriptor should be reported as unexpected.

Example descriptor:

PersonDescriptor:
  name: string
  email: string
  address: AddressDescriptor

AddressDescriptor:
  street: string
  city: string

Example input:

{
  "name": "John Adams",
  "email": "johnadams@gmail.com",
  "address": "111 street"
}

The input is invalid because address is expected to be an object matching AddressDescriptor, but the provided value is a string.

Implement:

validate(config, descriptor) -> list of validation errors

The validator should recursively check nested object descriptors and list descriptors. Each validation error should include enough information to identify where the problem occurred, such as the field path and the expected versus actual type.

Your implementation should handle at least the following cases:

  1. Missing required fields.
  2. Unexpected extra fields.
  3. Primitive type mismatches.
  4. Nested object validation.
  5. List validation, including invalid element types.
  6. Clear error reporting for multiple errors in the same config.

Do not use an external schema validation library.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Applied•More Machine Learning Engineer•Applied Machine Learning Engineer•Applied Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.