Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Subscription API] Purpose of Filter schema object in OAS not clear #1040

Open
HenriKorver opened this issue Jul 30, 2022 · 9 comments
Open

Comments

@HenriKorver
Copy link

HenriKorver commented Jul 30, 2022

In the OAS for the Subscription API the Filter object is included:

Filter:
      title: "Filter"
      description: "A filter from a selection of multiple filter types and dialects"
      type: object
      additionalProperties: true

The Filter object is used in all the filter dialects as the basis of the allOf construction, for instance in the ExactFilter:

ExactFilter:
      allOf:
        - $ref: "#/components/schemas/Filter"
        - type: object
          title: "exact filter"
          description: "This filter evaluates to 'true' if the 'value' exactly matches the value of the indicated CloudEvents context attribute"
          properties:
            exact:
              $ref: "#/components/schemas/CloudEventsAttribute"
          additionalProperties: false

It is not clear for me what the purpose is of this allOf construction with the Filter object as basis schema. It seems that the Filter object offers an extension mechanism to the standard filter dialects (All, Any, Not, Exact, Suffix, Prefix, etc.) because it contains the clause additionalProperties: true. Could somebody give me a concrete example of a JSON filter expression where this is used?

@HenriKorver
Copy link
Author

In addition to the question above. In some filter dialects the Filter object is also used in the oneOf- besides the allOf-construction. This seems to be incorrect (see #1038)

AllFilter:
      allOf:
        - $ref: "#/components/schemas/Filter"
        - type: object
          description: "all filter"
          properties:
            all:
              description: "This filter evaluates to 'true' if all contained filters are 'true'"
              type: array
              minItems: 1
              items:
                title: "Filter entry"
                oneOf:
                - $ref: "#/components/schemas/Filter"
                - $ref: "#/components/schemas/AllFilter"
                - $ref: "#/components/schemas/AnyFilter"
                - $ref: "#/components/schemas/NotFilter"
                - $ref: "#/components/schemas/ExactFilter"
                - $ref: "#/components/schemas/PrefixFilter"
                - $ref: "#/components/schemas/SuffixFilter"
                - $ref: "#/components/schemas/SqlFilter"
          additionalProperties: false

@duglin
Copy link
Collaborator

duglin commented Aug 9, 2022

I believe this was done to allow for new filter expressions to be defined. But as you noted #1038 perhaps we need to define it differently since it matches everything.

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no
activity. Mark as fresh by updating e.g., adding the comment /remove-lifecycle stale.

@HenriKorver
Copy link
Author

/remove-lifecycle stale

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no
activity. Mark as fresh by updating e.g., adding the comment /remove-lifecycle stale.

@HenriKorver
Copy link
Author

/remove-lifecycle stale

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no
activity. Mark as fresh by updating e.g., adding the comment /remove-lifecycle stale.

@HenriKorver
Copy link
Author

/remove-lifecycle stale

@github-actions
Copy link

This issue is stale because it has been open for 30 days with no
activity. Mark as fresh by updating e.g., adding the comment /remove-lifecycle stale.

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

No branches or pull requests

2 participants