Skip to content

namespacePrefixes not available in the Context constructor #43

Closed

Description

@nik-west

I want to replace the old and not supported library with this fork.

The issue I am facing is that previously there was a namespacePrefixes, used to map namespace to prefix, as an optional parameter to the constructor, when Context is created.
Is there some way to use this functionality with @mitre/jsonix?

Previously - https://github.com/highsource/jsonix/wiki/Configuring-Namespace-Prefixes
Now - https://github.com/mitre/jsonix/blob/master/nodejs/scripts/types/main.d.ts

export class Context {
  /**
   * Creates an instance of Context.
   *
   * @param {any[]} s (description)
   */
  constructor(s: any[]);
}

Any help will be appreciated
Thanks!

Activity

  1. mbaer3000 commented on Jul 4, 2024

    @mbaer3000

    Hi there! A question to the Mitre people: Is this project still alive? @bhogan-mitre @jhopper-mitre @sbowman-mitre

  2. mbaer3000 commented on Jul 4, 2024

    @mbaer3000

    @nik-west From looking at the code it appears to me that merely the typing is a bit off, the functionality should in fact still be there. Will investigate further.

  3. Amndeep7 commented on Aug 12, 2024

    @Amndeep7

    Hi @mbaer3000 sorry for not seeing this issue. This project is still alive in at least a maintenance mode. W/r to your request, if you are able to submit a PR, please tag me and I will review it and see if we can get it merged in and released.

  4. nik-west commented on Aug 12, 2024

    @nik-west
    Author

    Hi @Amndeep7, we already opened a PR . It's a one line in scripts/src/main/javascript/org/hisrc/jsonix/Jsonix/Context.js, for initializing p before using it(it's another problem that we faced during testing). If you can review it, it will be great and we will either submit another fix for better typing, or directly push in the current one.
    Thanks!

  5. Amndeep7 commented on Aug 12, 2024

    @Amndeep7

    @nik-west I'm having @Hookwitz take a look at this in the next few days. If you could submit a separate PR, that'd be great.

  6. Hookwitz commented on Aug 15, 2024

    @Hookwitz

    @nik-west , I've approved the PR and merged it in.

    In reviewing the code, it does appear the construction should be able to accept mappings and options according to https://github.com/mitre/jsonix/blob/master/nodejs/scripts/jsonix.js#L5693C26-L5693C34 (hopefully that link works)
    To type this, there should be an optional options that is either strictly defined as namespacePrefixs: Record<String, unknown> and/or supportXsiType: Boolean (these are the only two options that I can see from the clause blocks within the initialize function).

    I was not the original author of the main type declaration file, but would welcome a PR with the suggested options parameter to work with the rest of the library.

    Off the top of my head it may look something like this:

    type Mappings = Record<string, unknown>
    
    interface Options {
        namespacePrefix?: Record<string, string>;
        supportXsiType?: boolean;
    }
    
    ....
    
    constructor(mappings: Mappings[], options?: Options);
    
  7. linked a pull request that will close this issuedefine p as var, before using it #44on Jun 24, 2025
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions