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

[Improvement] flagd json schema files should be namespaced under resources #843

Closed
Kavindu-Dodan opened this issue Jun 21, 2024 · 5 comments · Fixed by #850
Closed

[Improvement] flagd json schema files should be namespaced under resources #843

Kavindu-Dodan opened this issue Jun 21, 2024 · 5 comments · Fixed by #850
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@Kavindu-Dodan
Copy link
Collaborator

Kavindu-Dodan commented Jun 21, 2024

Background

flagd provider utilizes schema files to validate flags when working in in-process mode. Currently, these json schema files are copied when building the binary to resources and kept in the root level [1]. And they are named flags.json & targeting.json.

Problem

In an application that uses flagd Java provider for feature flagging, there can be conflicting JSON files with similar names to the above schema files in the classpath. This especially concerns the name flags.json as many flagd examples use flags.json as a flag source file.

Improvement

Given our underlying library (seems to) support namespaced locations [2], we should improve our schema locations with an appropriate namespace to avoid classpath conflicts.

AC

Provider works & validates flags correctly with the namespaced schemas in the classpath.

[1] - https://github.com/open-feature/java-sdk-contrib/blob/dev.openfeature.contrib.providers.flagd-v0.8.3/providers/flagd/pom.xml#L236-L258
[2] - https://github.com/networknt/json-schema-validator/blob/master/doc/schema-retrieval.md#configuring-mappings

@Kavindu-Dodan Kavindu-Dodan added this to the flagd-0.8.4 milestone Jun 21, 2024
@Kavindu-Dodan Kavindu-Dodan added enhancement New feature or request good first issue Good for newcomers labels Jun 21, 2024
@mehtasankets
Copy link
Contributor

@Kavindu-Dodan I can take a stab at this.

Can we finalize on the new namespace locations to use?
I propose classpath:schemas/flagd/{flags|targeting}.json and classpath:/schemas/flagd/inprocess/{flags|targeting}.json

@Kavindu-Dodan
Copy link
Collaborator Author

Kavindu-Dodan commented Jun 25, 2024

@mehtasankets

I can take a stab at this

Nice.

Regarding the schema, I think flagd/schemas is better. And then place the json schema files targeting.json & flags.json under that resource directory.

flagd/schemas/flags.json , flagd/schemas/targeting.json

@Kavindu-Dodan
Copy link
Collaborator Author

Assigned the issue to you @mehtasankets . Let me know if you have further doubts

mehtasankets added a commit to mehtasankets/java-sdk-contrib that referenced this issue Jun 28, 2024
Signed-off-by: Sanket Mehta <mehtasankets@gmail.com>
mehtasankets added a commit to mehtasankets/java-sdk-contrib that referenced this issue Jun 28, 2024
Signed-off-by: Sanket Mehta <mehtasankets@gmail.com>
@mehtasankets
Copy link
Contributor

@Kavindu-Dodan for review: #850

@Kavindu-Dodan
Copy link
Collaborator Author

@mehtasankets thanks for the PR. Will include this with the next release :)

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

Successfully merging a pull request may close this issue.

2 participants