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

Split data.json / 1 json per company #8

Closed
edoardocostantinidev opened this issue Feb 14, 2022 · 9 comments
Closed

Split data.json / 1 json per company #8

edoardocostantinidev opened this issue Feb 14, 2022 · 9 comments
Assignees
Labels
feature New feature or request

Comments

@edoardocostantinidev
Copy link
Collaborator

edoardocostantinidev commented Feb 14, 2022

Given the growing number of companies inside data.json I propose to split them following this logic:
For each company there is a single json file located in a subfolder companies.
This would improve contributing to the repo.

I can take care of this fix if you agree @alessandromr.

@edoardocostantinidev edoardocostantinidev changed the title Separare data.json in un json per azienda Split data.json / 1 json per company Feb 14, 2022
@FabrizioCafolla
Copy link
Contributor

FabrizioCafolla commented Feb 14, 2022

Great!

Once separated in multiple files it is necessary to create a validator (maybe with json-schema) so we can test the pr and reject automatically in case of wrong data

Do you think you can implement this feature: split + validator?

Or separate into two issues?

@edoardocostantinidev
Copy link
Collaborator Author

Great!

Once separated in multiple files it is necessary to create a validator (maybe with json-schema) so we can test the pr and reject automatically in case of wrong data

Do you think you can implement this feature: split + validator?

Or separate into two issues?

Yes seems fair to add some tests with this refactor, I'll take care of it 👍🏻

@alessandromr
Copy link
Member

alessandromr commented Feb 14, 2022

Validator seems a great idea for the format of the json file. The go generation already checks the structure of the json but not the format.

@FabrizioCafolla
Copy link
Contributor

This is the json-schema that replicates the current structure:

{
	"$schema": "https://json-schema.org/draft/2019-09/schema",
      
    "properties": {
      	"name": {
        	"type": "string",
        	"description": "Comapny name"
      	},
          
    	"url": {
    		"type": "string",
    		"format": "uri",
    		"pattern": "^(https?)://",
            "description": "URL Comapny site"
		},
          
      	"career_page_url": {
    		"type": "string",
    		"format": "uri",
    		"pattern": "^(https?)://",
            "description": "URL Comapny career page"

		},
          
        "type": {
    		"type": ["string", "array"],
        	"enum": ["product", "consulting"],
            "description": "Type of services offered by the company"
        },
          
      	"tags": {
          "type": "array",
          "description": "Technology used"
        }
    },
    
    "additionalProperties": false,
    
    "required": ["name", "url", "career_page_url", "type", "tags"]
}

Example json:

{
    "name": "test",
    "url": "https://test.com",
    "career_page_url": "https://test",
    "type": "product",
    "tags": ["aws"]
}

@alessandromr I think it is appropriate to add to "type" values such as: B2C, D2C B2B etc..

@edoardocostantinidev
Copy link
Collaborator Author

I think it's best if we open another issue to discuss json schema as it probably also needs a template change @FabrizioCafolla @alessandromr .

@edoardocostantinidev
Copy link
Collaborator Author

edoardocostantinidev commented Feb 14, 2022

I also think it's a good idea to add the validator step inside the PR flow so we avoid to bring a non working status to main branch. aka merge only if it compiles. Probably needs another issue as well :)

@alessandromr
Copy link
Member

Closed with #16
I will open another PR for validation during pull request workflow

@brucellino
Copy link
Contributor

I came here looking for the JSON schema... I was going to suggest adding a pre-commit hook to perform the schema validation, but it seems you guys are doing this with a small go program. What's the current approach?

@edoardocostantinidev
Copy link
Collaborator Author

@brucellino as of right now we just run a GHA that checks and validates the json. No schema involved everything is pretty basic. We are also thinking about auto-generating PRs #327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants