Skip to content

Documentation mismatch for N-API structures #13469

Description

@RReverser

Documentation on the N-API page describes napi_property_attributes as following:

typedef enum {
  napi_default = 0,
  napi_read_only = 1 << 0,
  napi_dont_enum = 1 << 1,
  napi_dont_delete = 1 << 2,
  napi_static_property = 1 << 10,
} napi_property_attributes;

whereas src/node_api_types.h describes it as:

typedef enum {
  napi_default = 0,
  napi_writable = 1 << 0,
  napi_enumerable = 1 << 1,
  napi_configurable = 1 << 2,

  // Used with napi_define_class to distinguish static properties
  // from instance properties. Ignored by napi_define_properties.
  napi_static = 1 << 10,
} napi_property_attributes;

Basically, values of all bit flags were inverted.

Given the last commit, it seems it's the documentation that is outdated here but would be nice to confirm and sync two places to agree with each other.

Another one is napi_property_descriptor - website docs don't mention second name field of type napi_value.

Activity

  1. added
    docIssues and PRs related to Node.js documentation.
    node-apiIssues and PRs related to Node-API.
    on Jun 5, 2017
  2. mscdex commented on Jun 5, 2017

    @mscdex
    Contributor

    /cc @nodejs/n-api

  3. RReverser commented on Jun 5, 2017

    @RReverser
    MemberAuthor

    @mscdex Right, thanks, forgot I can add labels and mention corresponding group myself...

  4. jasongin commented on Jun 5, 2017

    @jasongin
    Member

    Yes, the documentation is out of date. These changes were made in the code after that part of the documentation was originally written, and we forgot to update the doc.

  5. mhdawson commented on Jun 5, 2017

    @mhdawson
    Member

    Will take a look at updating this tomorrow.

  6. RReverser commented on Jun 8, 2017

    @RReverser
    MemberAuthor

    Another one: napi_create_symbol expects a char * for description according to docs, but napi_value in actual header file. Not sure which one is intended here (I would expect the char *)?

    Moved to a separate issue: #13555

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

    docIssues and PRs related to Node.js documentation.node-apiIssues and PRs related to Node-API.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      Sponsor
      SponsoredKunjungi sekarang
      Promo