OpenAPITools / openapi-diff

Utility for comparing two OpenAPI specifications.
Apache License 2.0
772 stars 153 forks source link

Changes in 'example', "examples" are not handled #666

Open DrSatyr opened 3 weeks ago

DrSatyr commented 3 weeks ago

'example' and "examples" fields in OpenAPI objects (eg Parameter, Schema, MediaType, Header) are not compared.

Old schema:

schema:
    type: string,
    example: old example

New schema:

schema:
    type: string,
    example: new example

Such fields are not valuable for API functionality, but they are important from an API documentation perspective. Descriptions are already handled, so my suggestion is to handle examples as well.

mhiggins-SA commented 3 weeks ago

This is not correct. For OAS 3.1:

examples:

Mise le meas,

Micheál Higgins Senior Solutions Architect SmartBear Software

Sent from my iPad

On 1 Jun 2024, at 15:56, Aliaksandr Pinchuk @.***> wrote:



'example' and "examples" fields in OpenAPI objects (eg Parameter, Schema, MediaType, Header) are not compared.

Old schema:

schema: type: string, example: old example

New schema:

schema: type: string, example: new example

Such fields are not valuable for API functionality, but they are important from an API documentation perspective. Descriptions are already handled, so my suggestion is to handle examples as well.

— Reply to this email directly, view it on GitHubhttps://github.com/OpenAPITools/openapi-diff/issues/666, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ANMNL5TOC55HDFNWKYE6EBTZFHOJZAVCNFSM6AAAAABIUG6IW2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGMZDSMJYGU3TEOA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

We hope you found this email of interest; however, click here if you wish to unsubscribehttp://www2.smartbear.com/SubscriptionCenter.html?utm_source=outlook&utm_medium=email&utm_content=emailsig or manage your email preferences. Privacy Policy.https://smartbear.com/privacy/

Disclaimer

The information contained in this communication from the sender is confidential. It is intended solely for use by the recipient and others authorized to receive it. If you are not the recipient, you are hereby notified that any disclosure, copying, distribution or taking action in relation of the contents of this information is strictly prohibited and may be unlawful.

DrSatyr commented 3 weeks ago

@mhiggins-SA Sorry, it's my bad, the provided schemas did not explain all the cases. For sure OAS 3.1 introduces "examples" in favor of deprecated "example". But openapi-diff works with all versions of specifications (Swagger 2.0, OAS 3.0, OAS 3.1).

Basically, I would say that openapi-diff does not handle "examples" and "example" in all versions of the specification. Currently, I am working on PR to solve this, so will cover all versions.