X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=capifcore%2Fgenerate.sh;h=bcc336f1e2e535dc353cd1c218693f21c5949fef;hb=refs%2Fchanges%2F27%2F12327%2F1;hp=f3cf738079c41e7dfc2d49db086498645dc548d8;hpb=c2422dba52b7c2fe640ff957137ccf64d2c96753;p=nonrtric%2Fplt%2Fsme.git diff --git a/capifcore/generate.sh b/capifcore/generate.sh index f3cf738..bcc336f 100755 --- a/capifcore/generate.sh +++ b/capifcore/generate.sh @@ -2,7 +2,8 @@ # ========================LICENSE_START================================= # O-RAN-SC # %% -# Copyright (C) 2022: Nordix Foundation +# Copyright (C) 2022-2023: Nordix Foundation. All rights reserved +# Copyright (C) 2023: OpenInfra Foundation Europe. All rights reserved # %% # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -52,6 +53,7 @@ jar xvf common29554apidef.zip jar xvf common29571apidef.zip jar xvf common29572apidef.zip +# Remove types that are not used by CAPIF that have dependencies to other specifications. sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\CivicAddress/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml mv temp.yaml TS29571_CommonData.yaml sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\ExternalMbsServiceArea/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml @@ -72,6 +74,8 @@ sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\MbsSession/{s/^\( *\). mv temp.yaml TS29571_CommonData.yaml sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\SpatialValidityCond/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml mv temp.yaml TS29571_CommonData.yaml + +# Remove attributes that can not be generated easily. sed '/accessTokenError.*/,+3d' TS29571_CommonData.yaml >temp.yaml mv temp.yaml TS29571_CommonData.yaml sed '/accessTokenRequest.*/,+3d' TS29571_CommonData.yaml >temp.yaml @@ -80,9 +84,11 @@ mv temp.yaml TS29571_CommonData.yaml sed '/oneOf.*/,+2d' TS29222_CAPIF_Publish_Service_API.yaml >temp.yaml mv temp.yaml TS29222_CAPIF_Publish_Service_API.yaml -sed '64,68d' TS29222_CAPIF_Discover_Service_API.yaml >temp.yaml # Remove parameter preferred-aef-loc since it doesn't follow the OpenApi specification, "The behavior for nested objects and arrays is undefined." -mv temp.yaml TS29222_CAPIF_Discover_Service_API.yaml +sed '/oneOf.*/,+2d' TS29222_CAPIF_Security_API.yaml >temp.yaml +mv temp.yaml TS29222_CAPIF_Security_API.yaml +# Replace references to external specs that are collected to the common spec by the commoncollector +# cat TS29122_CommonData.yaml | sed 's/TS29572_Nlmf_Location/CommonData/g' > temp.yaml mv temp.yaml TS29122_CommonData.yaml cat TS29122_CommonData.yaml | sed 's/TS29554_Npcf_BDTPolicyControl/CommonData/g' > temp.yaml @@ -93,8 +99,6 @@ cat TS29571_CommonData.yaml | sed 's/TS29514_Npcf_PolicyAuthorization/CommonData mv temp.yaml TS29571_CommonData.yaml cat TS29571_CommonData.yaml | sed 's/TS29572_Nlmf_Location/CommonData/g' > temp.yaml mv temp.yaml TS29571_CommonData.yaml -cat TS29571_CommonData.yaml | sed 's/TS29571_CommonData.yaml//g' > temp.yaml # This spec has references to itself that need to be removed -mv temp.yaml TS29571_CommonData.yaml cat TS29222_CAPIF_Publish_Service_API.yaml | sed 's/TS29572_Nlmf_Location/CommonData/g' > temp.yaml mv temp.yaml TS29222_CAPIF_Publish_Service_API.yaml cat TS29222_CAPIF_Routing_Info_API.yaml | sed 's/TS29520_Nnwdaf_EventsSubscription/CommonData/g' > temp.yaml @@ -103,9 +107,11 @@ cat TS29222_CAPIF_Routing_Info_API.yaml | sed 's/TS29510_Nnrf_NFManagement/Commo mv temp.yaml TS29222_CAPIF_Routing_Info_API.yaml cat TS29222_CAPIF_Events_API.yaml | sed 's/TS29523_Npcf_EventExposure/CommonData/g' > temp.yaml mv temp.yaml TS29222_CAPIF_Events_API.yaml +# -go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.10.1 -PATH=$PATH:~/go/bin +# This spec has references to itself that need to be removed +cat TS29571_CommonData.yaml | sed 's/TS29571_CommonData.yaml//g' > temp.yaml +mv temp.yaml TS29571_CommonData.yaml cd $cwd @@ -128,6 +134,9 @@ go build . cd $cwd +go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.10.1 +PATH=$PATH:~/go/bin + echo "Generating TS29122_CommonData" mkdir -p internal/common29122 oapi-codegen --config gogeneratorspecs/common29122/generator_settings.yaml specs/TS29122_CommonData.yaml