ks-no / fiks-arkiv-specification

MIT License
4 stars 4 forks source link

Allow null values to Skjermingshjemmel and skjermingMetadata #220

Open shridhartpatil24 opened 1 week ago

shridhartpatil24 commented 1 week ago

When we create case with less records without Skjermingshjemmel and skjermingMetadata case gets created.

However, while attempting to retrieve those records via the below request, we see required and minimum length validation for not added fields.

can we remove these validation from below requests

Søk på mappe (mappeSokdefinisjon) og felt='mappeTittel' med responsType='minimum'

Søk på mappe (mappeSokdefinisjon) og felt='mappeTittel' med responsType='utvidet'

Søk på saksmappe (saksmappeSokdefinisjon) og felt='mappeTittel' med responsType='minimum'

Søk på saksmappe (saksmappeSokdefinisjon) og felt='sakSaksdato' mellom 2 datoer med responsType 'minimum'

Untitled

sturtzel commented 1 week ago

If there is no skjerming, the object should be omitted. If the object is present it means that there is skjerming and then two required skjerming fields must be present.

I expect that the result is made including empty skjerming.

shridhartpatil24 commented 1 week ago

We have data for Tilgangsrestriksjon but not for Skjermingshjemmel. However, when we pass null to the skjerming object as per your suggestion, we still encounter an error related to SkjermingMetadata for SkjermingMinimum

image

sturtzel commented 1 week ago

And the payload is ...

</systemID>
<dokumentbeskrivelse>

?

This is not valid (according to Noark):

<skjerming>
<tilgangsrestriksjon>U</tilgangsrestriksjon>
</skjerming>

Please add the payload to clearify.

shridhartpatil24 commented 1 week ago

<?xml version="1.0" encoding="utf-8"?>

<sok xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/sok/v1">
    <system>Fiks protokoll validator</system>
    <take>100</take>
    <skip>0</skip>
    <sokdefinisjon xsi:type="saksmappeSokdefinisjon">
        <responstype>minimum</responstype>
        <parametere>
            <operator>wildcardquery</operator>
            <sokVerdier>
                <stringvalues>
                    <value>Test*</value>
                </stringvalues>
            </sokVerdier>
            <felt>mappeTittel</felt>
        </parametere>
    </sokdefinisjon>
</sok>

<-------------------------------result------->

<resultatMinimum>
      <saksmappe>
        <systemID label="360" xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">6a451f5e-9d87-48d5-b8cb-e6343a3f11fe</systemID>
        <mappeID xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">24/00001</mappeID>
        <tittel xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">Test</tittel>
        <offentligTittel xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">Test</offentligTittel>
        <referanseEksternNoekkel xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">
          <fagsystem xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1">Fiks protokoll validator</fagsystem>
          <noekkel xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1">45d947ed-8455-46e2-a04f-ee18da433fe0</noekkel>
        </referanseEksternNoekkel>
        <saksaar xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">2024</saksaar>
        <sakssekvensnummer xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">1</sakssekvensnummer>
        <saksdato xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">2024-09-20</saksdato>
        <administrativEnhet xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">
          <navn xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1">Test Accounts</navn>
          <identifikator xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1" />
          <initialer xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1" />
        </administrativEnhet>
        <saksansvarlig xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">
          <initialer xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1" />
        </saksansvarlig>
        <saksstatus xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">
          <kode xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1">Under behandling</kode>
          <beskrivelse xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1">Under behandling</beskrivelse>
        </saksstatus>
      </saksmappe>
    </resultatMinimum>
sturtzel commented 1 week ago

This one should validate. No skjerming object here.

shridhartpatil24 commented 1 week ago

but we still encounter an error related to SkjermingMetadata on validator

jarleborsheim commented 1 week ago

Have you tried validating that xml result against the xsd instead of using the validator? The no.ks.fiks.arkiv.v1.innsyn.sok.resultat.minimum.xsd file

shridhartpatil24 commented 1 week ago

not, we only validate payload request not result

sturtzel commented 1 week ago

The search requests don't have any such objects. Double check what you're actually validating.

jarleborsheim commented 1 week ago

I had a look at your test session. The validator is showing validator errors from validating your xml against the xsd no.ks.fiks.arkiv.v1.innsyn.sok.resultat.minimum.xsd. The result you posted earlier is not the whole truth. There is a list of results. When you see a little further down that list of results in the xml, you are indeed sending a "saksmappe" with "skjerming".

<saksmappe>
        <systemID label="360" xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">58d53a71-3c69-4f74-9a4c-7f4ea2649252</systemID>
        <mappeID xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">24/00010</mappeID>
        <tittel xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">test old</tittel>
        <offentligTittel xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">test old</offentligTittel>
        <skjerming xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/arkivstruktur/minimum/v1">
          <tilgangsrestriksjon>
            <kode xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1">U</kode>
            <beskrivelse xmlns="https://ks-no.github.io/standarder/fiks-protokoll/fiks-arkiv/metadatakatalog/v1">Ugradert</beskrivelse>
          </tilgangsrestriksjon>
          <skjermingshjemmel>Offl. § 31</skjermingshjemmel>
        </skjerming>

Now, as I told you, this is where the xsd expects a skjermingMetadata that is required. Please refer to the xsd's and test locally as well. Your output should be valid and therefore I would recommend at least have some tests that checks this.

But also as I told you, the real question here is if skjermingMetadata is something that we need in that xsd, and/or if it is required. What do you think @sturtzel ?

Here is the line in question in the xsd: https://github.com/ks-no/fiks-arkiv-specification/blob/c99607cf40da7441fea528c2210d35af7a59a85d/Schema/V1/arkivstrukturMinimum.xsd#L155

shridhartpatil24 commented 1 week ago

@jarleborsheim I agree with you but the result you pasted which have skjermingshjemmel data and I talking about other cases which don't have skjermingshjemmel for those I am getting that error of skjermingMetadata

sturtzel commented 1 week ago

No, this element is an error. Ref. skjerming in the arkivstruktur.xsd. The minimum should be a subset of this one:

    <xs:complexType name="skjerming">
        <xs:sequence>
            <xs:element name="tilgangsrestriksjon" type="n5mdk:tilgangsrestriksjon"/>
            <xs:element name="skjermingshjemmel" type="n5mdk:skjermingshjemmel"/>
            <xs:element name="skjermingOpphoererDato" type="n5mdk:skjermingOpphoererDato" minOccurs="0"/>
            <xs:element name="skjermingOpphoererAksjon" type="n5mdk:skjermingOpphoererAksjon" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>

I suggest that minimum should be with the two required only as the object has its own definition.

jarleborsheim commented 1 week ago

@jarleborsheim I agree with you but the result you pasted which have skjermingshjemmel data and I talking about other cases which don't have skjermingshjemmel for those I am getting that error of skjermingMetadata

Please test locally first your output against the xsd, the validator only tests with the xsd's. And send me a session then in the validator where you are not sending "saksmappe" with "skjerming".

sturtzel commented 1 week ago

Skjerming without skjerminghjemmel has no use as hjemmel is required in Offentleglova.

jarleborsheim commented 1 week ago

No, this element is an error. Ref. skjerming in the arkivstruktur.xsd. The minimum should be a subset of this one:

    <xs:complexType name="skjerming">
        <xs:sequence>
            <xs:element name="tilgangsrestriksjon" type="n5mdk:tilgangsrestriksjon"/>
            <xs:element name="skjermingshjemmel" type="n5mdk:skjermingshjemmel"/>
            <xs:element name="skjermingOpphoererDato" type="n5mdk:skjermingOpphoererDato" minOccurs="0"/>
            <xs:element name="skjermingOpphoererAksjon" type="n5mdk:skjermingOpphoererAksjon" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>

I suggest that minimum should be with the two required only as the object has its own definition.

Yes, I thought so as well. I will fix this and we will discuss if this can be released as a patch fix in our next meeting.

jarleborsheim commented 1 week ago

Pull request : https://github.com/ks-no/fiks-arkiv-specification/pull/221

jarleborsheim commented 1 week ago

Skjerming without skjerminghjemmel has no use as hjemmel is required in Offentleglova.

What you're saying then @sturtzel is that skjermingshjemmel is correctly required in the xsd. The error you're seeing @shridhartpatil24 in regards of a skjerming missing a skjermingshjemmel is correct. You need that to send a skjerming in your response. But the skjermingMetadata requirement is something that we will hopefully fix with a patch release.