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

Yaml: Invalid behaviour for empty nodes #4843

Closed
xorik opened this issue Jul 14, 2018 · 8 comments
Closed

Yaml: Invalid behaviour for empty nodes #4843

xorik opened this issue Jul 14, 2018 · 8 comments
Labels
lang:yaml Issues affecting YAML locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:awaiting response Issues that require answers to questions from maintainers before action can be taken

Comments

@xorik
Copy link

xorik commented Jul 14, 2018

Prettier pr-4742
Playground link

--parser yaml

Input:

framework:
    secret: '%env(APP_SECRET)%'
    #default_locale: en
    #csrf_protection: true
    #http_method_override: true

    # Enables session support. Note that the session will ONLY be started if you read or write from it.
    # Remove or comment this section to explicitly disable session support.
    session:
        handler_id: ~

    #esi: true
    #fragments: true
    php_errors:
        log: true

    cache:
        # Put the unique name of your app here: the prefix seed
        # is used to compute stable namespaces for cache keys.
        #prefix_seed: your_vendor_name/app_name

        # The app cache caches to the filesystem by default.
        # Other options include:

        # Redis
        #app: cache.adapter.redis
        #default_redis_provider: redis://localhost

        # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
        #app: cache.adapter.apcu

Output:

framework:
  secret: "%env(APP_SECRET)%"
  #default_locale: en
  #csrf_protection: true
  #http_method_override: true

  # Enables session support. Note that the session will ONLY be started if you read or write from it.
  # Remove or comment this section to explicitly disable session support.
  session:
    handler_id: ~

  #esi: true
  #fragments: true
  php_errors:
    log: true

  ? cache
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name

# The app cache caches to the filesystem by default.
# Other options include:

# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost

# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu

Expected behavior:
the cache section shouldn't be broken

@ikatyang

This comment has been minimized.

@ikatyang ikatyang added type:bug Issues identifying ugly output, or a defect in the program area:comments Issues with how Prettier prints comments scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency lang:yaml Issues affecting YAML labels Jul 15, 2018
@j-f1
Copy link
Member

j-f1 commented Jul 15, 2018

I think the issue is that the cache: got changed to ? cache.

@ikatyang
Copy link
Member

The formatting changes it from implicit key to explicit key, which is valid, see YAML 1.2 spec.

@ikatyang
Copy link
Member

@xorik Could you clarify what's your expected behavior? a sample code would be appreciated.

@ikatyang ikatyang added the status:awaiting response Issues that require answers to questions from maintainers before action can be taken label Jul 15, 2018
@ikatyang
Copy link
Member

Moved the comment issue #4843 (comment) to #4853.

@ikatyang ikatyang removed area:comments Issues with how Prettier prints comments scope:dependency Issues that cannot be solved inside Prettier itself, and must be fixed in a dependency type:bug Issues identifying ugly output, or a defect in the program labels Jul 17, 2018
@ikatyang
Copy link
Member

With the fix for #4853, it's now formatted as:

Prettier pr-4854
Playground link

--parser yaml

Input:

framework:
    secret: '%env(APP_SECRET)%'
    #default_locale: en
    #csrf_protection: true
    #http_method_override: true

    # Enables session support. Note that the session will ONLY be started if you read or write from it.
    # Remove or comment this section to explicitly disable session support.
    session:
        handler_id: ~

    #esi: true
    #fragments: true
    php_errors:
        log: true

    cache:
        # Put the unique name of your app here: the prefix seed
        # is used to compute stable namespaces for cache keys.
        #prefix_seed: your_vendor_name/app_name

        # The app cache caches to the filesystem by default.
        # Other options include:

        # Redis
        #app: cache.adapter.redis
        #default_redis_provider: redis://localhost

        # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
        #app: cache.adapter.apcu

Output:

framework:
  secret: "%env(APP_SECRET)%"
  #default_locale: en
  #csrf_protection: true
  #http_method_override: true

  # Enables session support. Note that the session will ONLY be started if you read or write from it.
  # Remove or comment this section to explicitly disable session support.
  session:
    handler_id: ~

  #esi: true
  #fragments: true
  php_errors:
    log: true

  cache:
    # Put the unique name of your app here: the prefix seed
    # is used to compute stable namespaces for cache keys.
    #prefix_seed: your_vendor_name/app_name
    # The app cache caches to the filesystem by default.
    # Other options include:
    # Redis
    #app: cache.adapter.redis
    #default_redis_provider: redis://localhost
    # APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
    #app: cache.adapter.apcu

@j-f1
Copy link
Member

j-f1 commented Jul 18, 2018

Should we close this then?

@no-response no-response bot closed this as completed Jul 29, 2018
@no-response
Copy link

no-response bot commented Jul 29, 2018

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@github-actions github-actions bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Oct 6, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:yaml Issues affecting YAML locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. status:awaiting response Issues that require answers to questions from maintainers before action can be taken
Projects
None yet
Development

No branches or pull requests

3 participants