Skip to content

BC: Address problems with v1.5 introducing arrays where items are "oneOf"different types #270

Closed

Description

@mrutkows

There are issues creating libraries/tools that implement as you need to do quite a bit of additional reflection to determine which "item" datatype to use. This problem is compound where one item is a primitive (e.g., string) and another an object (struct).

I plan to update this issue with all the cases that are (especially) problematic.

  • "environmentVars": mixing a string type with an object type is esp. problematic in coding implementations as not concrete structures (work around using structure that aggregates all fields from both types) can be created and code always must use reflection to determine which is cumbersome.
"environmentVars": {
          "title": "Environment variables",
          "description": "Inputs that have the form of parameters with names and values.",
          "type": "array",
          "uniqueItems": true,
          "items": {
            "oneOf": [
              {
                "$ref": "#/definitions/property"
              },
              {
                "type": "string"
              }
            ]
          }
  • "serviceData": mixing 2 named type. Thankfully, both resolve to "string" for now; however, the "bomLinkElementType" if changed to an "object" could cause typeing problems in impls.
   "source": {
          "type": "array",
          "items": {
            "anyOf": [
              {
                "title": "URL",
                "type": "string",
                "format": "iri-reference"
              },
              {
                "title": "BOM-Link Element",
                "$ref": "#/definitions/bomLinkElementType"
              }
            ]
          },

Another issue concerns as "legacy" objects can be removed; however, again we have an array of object vs. a single object with arrays in it.

  • Tools: One of
    • (single object) Creation Tools
      • despite allowing arrays (and links/refs) fully including all fields of "component" and/or "service" seems like overkill
    • (array of object) Creation Tools (legacy)
      • remove "legacy"

Activity

  1. changed the title [-]2.0: Address problems intro. with v1.5 with arrays where items are "oneOf" types[/-] [+]2.0: Address problems with v1.5 introducing arrays where items are "oneOf"different types[/+] on Jul 26, 2023
  2. jkowalleck commented on Jul 26, 2023

    @jkowalleck
    Member

    [...] environmentVars [...]

    this is the same as #249, right?

    PS: #249's goal is to make environmentVars a dictionary, removing the option for a string entirely.


    [...] source [...]

    this should be no issue. it is an array of iri-reference.
    You will see that #/definitions/bomLinkElementType references also iri-reference, but with a regex.
    So the type is either a iri-reference or a special iri-reference -- so both are iri-reference, right?

    however, the "bomLinkElementType" if changed to an "object" could cause typeing problems in impls.

    i do not see an object. could you point me to it?

  3. added
    CDX 1.5
    on Jul 26, 2023
  4. mrutkows commented on Jul 27, 2023

    @mrutkows
    ContributorAuthor

    @jkowalleck This adds a new perspective/concern in addition to #249

  5. mrutkows commented on Jul 31, 2023

    @mrutkows
    ContributorAuthor

    this should be no issue. it is an array of iri-reference. You will see that #/definitions/bomLinkElementType references also iri-reference, but with a regex. So the type is either a iri-reference or a special iri-reference -- so both are iri-reference, right?

    I acknowledged that both map to "string" now, however, since they are now both named types (definitions) and could easily be turned into "objects" with multiple fields which would cause similar issues.

  6. jkowalleck commented on Jul 31, 2023

    @jkowalleck
    Member

    I acknowledged that both map to "string" now, however, since they are now both named types (definitions) and could easily be turned into "objects" with multiple fields which would cause similar issues.

    I do not see any issues NOW nor is there a change for issues in the future.
    I'd suggest we clarify this in one of the upcoming meetings.

    PS: all your concerns would be breaking changes anyway, so I don't see a reason for discussion. Nobody intended to change some "string" to "object". it is just not happening, no matter if "named types" or not ...

  7. dn-scribe commented on Jan 21, 2024

    @dn-scribe
  8. jkowalleck commented on Jan 21, 2024

    @jkowalleck
  9. changed the title [-]2.0: Address problems with v1.5 introducing arrays where items are "oneOf"different types[/-] [+]BC: Address problems with v1.5 introducing arrays where items are "oneOf"different types[/+] on Feb 28, 2024
  10. jkowalleck commented on Nov 12, 2026

    @jkowalleck
    Member

    fixed per #1088 and others in 2.0

  11. added this to the 2.0 milestone on Nov 12, 2026
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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions