mapbox / mapbox/mapbox-gl-draw

Feature id should accept type `number`

Open
#1,176 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged docs
Dominant language
JavaScript
Stars
1.1k
Forks
612
Avg merge
8d 9h
Merged PRs (30d)
5

Description

mapbox-gl-draw provides a number of APIs that take a feature id as an argument or return it as a return value. Currently, the API documentation states that the `featureId` is a `string` value.

However, according to the GeoJSON specification, feature id can be a `string` or a `number`, so it seems odd that mapbox-gl-draw does not consider id of type `number`.

> If a Feature has a commonly used identifier, that identifier SHOULD be included as a member of the Feature object with the name "id", and the value of this member is either a JSON string or number.
> https://datatracker.ietf.org/doc/html/rfc7946#section-3.2

From the little testing I did at hand, there seemed to be no problem with mapbox-gl-draw operation even if a feature had an id of type `number`, but is there a reason why the current API documentation only specifies an id of type `string`? Also, is there any consideration to officially support id of type `number`?

Contributor guide

Open the contributing guide

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.

Research direction

Start by locating the API documentation and implementation or type declarations that define featureId as a string, then inspect the related feature-id usages and tests. Done means the supported type matches the GeoJSON string-or-number requirement and the API documentation and relevant tests reflect that support.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.