Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Mapping paths should allow arbitrary files

Open
#6,025 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
php
Domain
api, backend

Research direction

Start by tracing the mapping()->paths() configuration and how the supplied paths are discovered for API resources. Use the Finder example to compare directory and individual-file inputs, then verify that only the requested files are searched and that the container cache is unaffected by unrelated test changes.

Written by the indexing model from the issue text.

Description

Description
The mapping paths configuration currently only supports directories. This means that it must search all files within the directory for api resources. However, when tests are located next to code (as is done in other languages), this means that tests are also searched for resources. This slows down the container building as there are more files to be searched, as well as invalidates cache whenever a test changes.

It would be great to be able to specify the individual files to be checked instead of the directories that contain them.

Example

    $paths = Finder::create()
        ->in(__DIR__ . '/../src')
        ->notName('/.*Test.php/')
        ->files();

    $apiPlatform
        ->mapping()
        ->paths(array_map(fn ($path) => $path->getRealPath(), iterator_to_array($paths)));
Dominant language
PHP
Stars
2.6k
Forks
989
Avg merge
1d 22h
Merged PRs (30d)
100

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from api-platform/core

All issues in api-platform/core

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.