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

Policy API early expiration #680

Closed
kheraankit opened this issue Aug 11, 2021 · 9 comments · Fixed by #834
Closed

Policy API early expiration #680

kheraankit opened this issue Aug 11, 2021 · 9 comments · Fixed by #834
Labels
Policy Specific to the Policy API Schema Implications for JSON Schema or OpenAPI
Milestone

Comments

@kheraankit
Copy link

kheraankit commented Aug 11, 2021

A city operation defines a policy with a start and end date. Example: They define a no operating zone due to planned work going on the streets, for 2 days. The work gets finished earlier and now the city operator would like to revoke the policy so that vehicles are allowed. Currently, the policies are immutable as per the specification.

Describe the solution you'd like

  1. Allow the end date to be mutable and let the operators change it but then it goes against the specification and opens the flood gate of updating other fields in the future
  2. Create a new policy to override the existing policy [prev_policies] but with empty rules
  3. Create a separate endpoint to revoke/delete a policy?

Currently, we are recommending 2 to the city operators but wanted to get suggestions as to how others who have encountered similar use cases are handling it.

Impacted Spec

For which spec is this feature being requested?

  • policy
@schnuerle schnuerle added the Policy Specific to the Policy API label Aug 13, 2021
@avatarneil
Copy link
Contributor

avatarneil commented Sep 17, 2021

We're currently using #2 as well. This makes it clear when the change occurred that nullified the live policy, where as making end_date mutable would not necessarily capture that information (say, for example, if you changed the end_date to 2 days in the future).

#3 would be good too, but I think this starts to fall into the realm of policy authoring, which I believe to date the OMF has not wanted to define an API for because the authorship component is 100% city-side, and not defining a communication mechanism between Providers and Agencies. FWIW, though, we cut a PR a while back for adding a Policy Authoring API #497

#1 I'd be concerned about for precisely the reasons you mentioned!

-- EDIT -- Wrapped the numbers in backticks to avoid linking to PRs/issues automagically 😅

@kheraankit
Copy link
Author

kheraankit commented Sep 27, 2021

@avatarneil Thanks! We recommend #2 as well at Lime.

It would be nice if we can add an example for the same to policy examples.

@kheraankit
Copy link
Author

@schnuerle Can we update the document to state policies are immutable and add specific examples showing the early end of policies? We have encountered a few cases from cities and 3rd parties where they have ended the policies early by changing the dates.

@schnuerle schnuerle added this to the 2.0.0 milestone Dec 13, 2021
@schnuerle
Copy link
Member

Ok so for MDS 2.0 we can look at clarifying that policies are immutable, and adding more language to the spec about that. It's mentioned 3 times on the policy page, but maybe a new section about 'Updating or Ending Policies' that could be linked to is in order. Also adding an example with how to properly end or update a policy.

https://github.com/openmobilityfoundation/mobility-data-specification/tree/main/policy#policies

@xavfernandez
Copy link

2. Create a new policy to override the existing policy [prev_policies] but with empty rules would also have my preference.

But currently the JSON schema of policies seem to explicitly forbidden a policy with empty rules:

"rules": {
"$id": "#/definitions/rules",
"type": "array",
"description": "Array of applicable Rule objects",
"items": {
"$id": "#/definitions/policy/properties/rules/items",
"$ref": "#/definitions/rule"
},
"minItems": 1
}

(which was added in https://github.com/openmobilityfoundation/mobility-data-specification/pull/576/files#diff-c3c8c9c2d57f7519fe41d13c5b30d143c5e5e69fa3beb2f56a7cbdf5390c7a26R75 ) even though https://github.com/openmobilityfoundation/mobility-data-specification/blob/main/policy/README.md does not mention anything about this limitation.
Is the JSON schema wrong and should "minItems": 1 be removed ?

@avatarneil
Copy link
Contributor

@xavfernandez Oof, good catch. I think that the JSONSchema is wrong here, the minItems requirement should be removed IMO.

@schnuerle
Copy link
Member

schnuerle commented Jan 2, 2023

This "minItems": 1 issue should be fixed with the MDS 2.0 OpenAPI work to be done in #281

Will be adding a new section called 'Updating or Ending Policies' with new language, and adding an example to policy examples page.

@schnuerle schnuerle added the Schema Implications for JSON Schema or OpenAPI label Feb 4, 2023
@schnuerle schnuerle linked a pull request Feb 7, 2023 that will close this issue
@schnuerle
Copy link
Member

schnuerle commented Feb 7, 2023

See #680 for the new section and language to clarify "Updating or Ending Policies". Leave feedback here or in the PR.

I don't think an example is needed for this based on the clarified text. Examples also went through a lengthy review to ensure they matched real world common use cases. However, if anyone would like to propose an example, suggest it with specifics here and we could add it now, or in the next release with more review.

@schnuerle
Copy link
Member

Continue to leave comments here and if needed we can make tweaks during release review process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Policy Specific to the Policy API Schema Implications for JSON Schema or OpenAPI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants