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

If maxProperties is set, completion does not work for the last property #612

Closed
1 of 4 tasks
sfalmo opened this issue Dec 8, 2021 · 0 comments
Closed
1 of 4 tasks

Comments

@sfalmo
Copy link
Contributor

sfalmo commented Dec 8, 2021

Describe the bug

This is likely an off-by-one error.
Suppose a schema sets maxProperties: 3 for a certain object. In the yaml file using this schema, completion works for the first and second property of this object, but no completion suggestions are shown if one wants to add a third property.

Expected Behavior

The language server should suggest completions also in this case, since maxProperties sets an inclusive bound on the number of properties.

Current Behavior

No completions are shown. This is especially frustrating if maxProperties: 1, since there is no way to see the available properties of an object at all in this case.

Steps to Reproduce

Use the following example schema. Create someObject and add properties. You won't get completions for the third one.

$schema: http://json-schema.org/draft-07/schema
title: Test maxProperties
description: Test schema for completion of properties if maxProperties is set
type: object
properties:
  someObject:
    type: object
    properties:
      prop1:
        type: string
      prop2:
        type: string
      prop3:
        type: string
      prop4:
        type: string
    maxProperties: 3

prop1

prop2

prop3

Environment

  • Windows
  • Mac
  • Linux
  • other (please specify)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants