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 omitempty #1026

Open
erkylima opened this issue Mar 7, 2024 · 2 comments
Open

yaml omitempty #1026

erkylima opened this issue Mar 7, 2024 · 2 comments

Comments

@erkylima
Copy link

erkylima commented Mar 7, 2024

I was using this library, but we have a problem and i can try to fix it, Anyone more have the problem that can't omit empty data? It's a great function that will improve this library a lot.

@erkylima
Copy link
Author

erkylima commented Mar 7, 2024

It's a yaml generated with this library, but i wish omit the empty fields to reduce the file size. What do you think about that?

version: "3.7"
services:
    - container_name: PHP
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: NodeJS
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: Go
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: Java
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: Python
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: C++
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: C#
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: C
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: C++
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: C#
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
    - container_name: C
      build:
        context: ../
        dockerfile: .devops/Dockerfile
      volumes: []
      ports: []
      depends_on: []
      environment: []
      image: ""
networks:
    - das
volumes:
    - das

@IzhakJakov
Copy link

Hi @erkylima
Could you please provide a sample code for generating a shorter version of the output in this comment?

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