Skip to content

Generate fake mock data #309

Closed as not planned
Closed as not planned

Description

@Tanddant

A neat feature would be to use the mock feature with a tool like fakerjs and essentially be able to mock a full API, and generate random data.

For instance when building a user management tool it would be nice to be able to generate 100's of random users mocking the graph endpoints to test things like pagination without having to create those users in my dev tenant

Activity

  1. waldekmastykarz commented on Aug 8, 2023

    @waldekmastykarz
    Collaborator

    That's a great idea! Recently, we released a set of mocks for all Graph endpoints based on Graph API reference docs, but I can imagine that you might need some other/more content.

    Did you give some thought how you'd see it work? Would you like the Proxy to generate the mocks on the fly (making the outcomes dynamic but less predictable) or would you rather have something like a subcommand that you can use to generate a specific set of mocks, like m365proxy mock user --numItems 100 and the command would generate hundred mocked users in a mock file that you can plug into the Proxy?

  2. Tanddant commented on Aug 8, 2023

    @Tanddant
    Author

    That's a good question - my use case was actually just needing random data, I don't necessarily have an opinion on the "best way" - I guess the main thing is just mapping the Graph responses to a "mock" dataset

  3. added
    needs specIssue needs specification
    and removed
    needs peer reviewIssue needs review from other team members
    on Dec 13, 2023
  4. waldekmastykarz commented on Feb 26, 2026

    @waldekmastykarz
    Collaborator

    Looked at this in the context of our current capabilities. We've come a long way since this was originally filed.

    What exists now

    • MockGeneratorPlugin: Records live API responses into mock files. This gets you real data but requires actual API access.
    • LLM integration: We have ILanguageModelClient with OpenAI and Ollama backends plus a .prompty template system. This is the natural path for generating realistic fake data.
    • Mock file format: Supports complex response bodies, headers, arrays — everything needed for rich mock data.

    Proposed approach

    Rather than integrating a data generation library like Faker.js (wrong ecosystem — we're .NET), I think we should leverage our existing LLM infrastructure:

    CLI command: devproxy mock generate --openapi <spec> --use-language-model

    This ties directly into #531. When the --use-language-model flag is set:

    1. Parse the OpenAPI spec to get paths, operations, and response schemas
    2. For each operation, send the schema to the LLM with a prompt like: "Generate a realistic JSON response matching this schema for a {operationId} endpoint. Generate {count} items for array responses."
    3. Use the response as the mock body
    4. Save to mocks file

    Count/volume support: A --count flag could control how many items to generate for collection endpoints (e.g., --count 100 for the /users scenario from the original request).

    Pagination: For large collections, we could auto-generate paginated mock responses with proper @odata.nextLink or similar pagination markers, depending on the API style.

    This approach gives the best of both worlds: realistic data without needing actual API access, and it works for any API with an OpenAPI spec.

  5. waldekmastykarz commented on Oct 31, 2026

    @waldekmastykarz
    Collaborator

    Closing: language models now cover realistic data generation (see #531 / #2036), so a dedicated fake-data generator isn't needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs specIssue needs specification

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions