-
-
Notifications
You must be signed in to change notification settings - Fork 240
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
example-value-or-externalValue
should only target OAS3
#883
Comments
Does #882 also fix that the rule example-value-or-externalValue does get applied to example(s) properties in actual examples, too? I have an example that contains the properties example(s) and spectral complains about it not having a value or externalValue. Edit:
Not sure how to combine them, I am new to JSONPath. Thought it would be |
@m-mohr Good catch! This path seems indeed too broad.
I wonder if they should be combined. That might hinder the maintainability. #799 looks like bringing a capability that should make that easier. |
) * fix: $..examples is too broad (#883) * Added examples for headers. * Fix existing tests * Added new tests * A little more fine-grained JSON paths Co-authored-by: Jakub Rożek <jakub@rozek.tech> Co-authored-by: Vincenzo Chianese <vincenz.chianese@icloud.com>
There's a bit of a windy path here and I'm curious if the issue I'm seeing is related or something new. I have an OAS3 doc like this, where the example is on the object in the schema rather than on the request/response. The I'm thinking the rule should only catch openapi: 3.0.0
info:
title: Authentication
version: 0.0.1
description: Authentication and credential functionality.
contact:
name: My Name
url: https://my-company.com
servers:
- url: https://localhost
description: Local development host
tags:
- name: users
description: Management for user accounts and related data.
paths:
/authentication/v1/users/{id}/password:
put:
operationId: put-password-by-id
summary: Sets the specified user's password.
description: This operation sets the password for the specified user. The user's current password may be required depending on the user's authorization rights. The new password will be validated against password complexity and history requirements.
parameters:
- name: id
description: The ID of the user for whom the password should be set.
in: path
required: true
schema:
type: string
example: "758ce33c-5d7a-4300-bcb9-f26a19a22791"
requestBody:
description: An object containing the user's current and desired new passwords.
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/passwordChange'
responses:
'204':
description: The password was successfully changed.
tags:
- users
components:
schemas:
passwordChange:
type: object
description: Information required to change a user's password.
properties:
current:
description: The user's current password.
type: string
new:
description: The user's desired new password.
type: string
required:
- new
example:
current: "my-current-password"
new: "my-new-password" |
This should be fixed with the PRs mentioned above. We just need a new release... |
…1059) * chore(doc): Slightly enhance xor function description * chore(doc): Make the xor function example is little less abstract This example has been taken from the initial `example-value-or-externalValue` definition in the ruleset. The rule has since been updated but this doco example hasn't. Let's make the doco example a litlle less dependent on the concrete rule implementation. It's sole purpose is to provide a sample usage of the `xor`function. * fix(ruleset): Make `example-value-or-externalValue` only target oas3 Fix #883 Co-authored-by: Jakub Rożek <jakub@stoplight.io>
#882 puts under the light a minor issue:
value
orexternalValue
only make sense in the context of OAS3, but the ruleexample-value-or-externalValue
apply to both OAS2 and OAS3.#882 could be merged without incurring any breaking change. However, maybe should we rename the rule to
examples-value-or-externalValue
(and update the doco accordingly) to make it clear what it actually targets.The text was updated successfully, but these errors were encountered: