Skip to content

Usage of field vs property #2660

Closed
Closed

Description

@char0n

I was wondering if authors of the spec would be open to make usage of field and property somehow consistent. When we have specification objects we refer to it's properties as fields, either fixed one, patterned one or mapped one. Then in field descriptions we refer to those fields as properties.

Is there a semantic difference between field and property wording or some additional distinction between field vs property?

Activity

  1. darrelmiller commented on Jul 29, 2021

    @darrelmiller
    Member

    From the TDC discussion, we should make efforts to remove unnecessary ambiguity when using words such as keyword, property, attribute and field.
    Can we clarify when each of those terms should be used?
    Can we have a generic meta model for the OpenAPI document that connects terms to externally referenced terms?

    Can we limit terms to just object, property, map and array? /cc @webron Can we get your insight on why field was used?

  2. hudlow commented on Jul 29, 2021

    @hudlow
    Contributor

    I think there's a case to be made that we should reserve "property" for a subschema of an object schema: a subschema that defines valid members for a conforming object ("members" as defined by RFC 8259).

    To illustrate this distinction, we could say the Pet schema contains a id property even though we know the literal Pet schema object in an OpenAPI definition file won't have a member named id. Rather it will have a member named properties which has a member named id.

    "Member" seems a little esoteric to me, but if we defined "field" to also refer to a literal key-value pair in a JSON object, then we could say:

    • "The Pet schema contains an id property."
    • "The Pet schema object contains a properties field."
    • "The pet object contains an id field in conformance with the Pet schema."
    • "The id field within the properties field of the Pet schema object defines an id property for the Pet schema."

    But there are some confusing subtleties to this for sure. One of them would be that the required array would really refer to required fields. (In other words, I'm not sure "required properties" makes sense if properties are schemas for fields.)

    Edit: this certainly isn't how JSON Schema constrains the use of "property":

    An object instance is valid against this keyword if every item in the array is the name of a property in the instance.

    (Source: https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#section-6.5.3)

  3. swaldron58 commented on Jul 29, 2021

    @swaldron58

    My comment is beyond the scope of this specific issue but wanted to add another relationship to modeling taxonomy. In travel we use a shared domain model (Open Travel 2.) to describe business objects such as reservation, invoice, fare, guest/passenger and others. We as a community created a modeling tool and complier to take the model and create XSD and swagger files. Hence we have one definition of a service but can expose as either XML or JSON. Our (open source) complier takes the model, expressed itself in XML, and converts it. For swagger we already have to do some mapping. My point being how business objects are defined via various modeling approaches is affected by changes to OAS. It would be helpful to keep an eye on how business objects are defined (see #hudlow comment above) and not make it needlessly difficult to map them.

  4. added
    clarificationrequests to clarify, but not change, part of the spec
    on Jan 27, 2024
  5. handrews commented on May 27, 2024

    @handrews
    Member

    @OAI/tsc review request: Do we want to try to tackle this in the patch releases or punt it to 3.2 or Moonwalk?

  6. ralfhandl commented on May 28, 2024

    @ralfhandl
    Contributor

    @OAI/tsc review request: Do we want to try to tackle this in the patch releases or punt it to 3.2 or Moonwalk?

    That may depend on what we agree on, and how much time we want to spend finding agreement 😎

    Current statistics in 3.1.0

    • 169 occurrences of "field"
      • 30 of them in section headings
    • 129 occurrences of "property" or "properties"
      • 2 of them in section headings

    Consistent use of "field" instead of "property" would be the less invasive change, and I'd be fine with doing it in patch versions.

  7. lornajane commented on Jun 4, 2024

    @lornajane
    Contributor

    What Ralf said but I don't want to hold the patch releases for it. Let's aim for 3.2 and consider any other wording changes that should be part of the mission?

  8. added this to the v3.2.0 milestone on Jul 23, 2024
  9. modified the milestones: v3.2.0, v3.0.4 on Aug 17, 2024
  10. self-assigned this
    on Aug 30, 2024
  11. modified the milestones: v3.0.4, v3.2.0 on Aug 30, 2024
  12. ralfhandl commented on Aug 30, 2024

    @ralfhandl
    Contributor

    Already fixed in 3.0.4 and 3.1.1

  13. lornajane commented on Nov 4, 2024

    @lornajane
    Contributor

    @ralfhandl can we close this now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

clarificationrequests to clarify, but not change, part of the speceditorialWording and stylistic issuesreview

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions