blob: d65b7ecb13f4d1be8e1dc83a3f5bf62d8b0aea14 [file] [log] [blame]
elinuxhenrikc727c842022-02-11 08:29:36 +01001# -
2# ========================LICENSE_START=================================
3# O-RAN-SC
4# %%
5# Copyright (C) 2022: Nordix Foundation
6# %%
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18# ========================LICENSE_END===================================
19#
20
21cwd=$(pwd)
22
23mkdir internal/readonly/api
24
25curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.222/29222-g70.zip -o internal/readonly/api/apidef.zip
26curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.122/29122-g70.zip -o internal/readonly/api/commonapidef.zip
27curl https://www.3gpp.org/ftp/Specs/archive/29_series/29.571/29571-g70.zip -o internal/readonly/api/common29571apidef.zip
elinuxhenrikc727c842022-02-11 08:29:36 +010028
29cd internal/readonly/api/
30
31jar xvf apidef.zip
32jar xvf commonapidef.zip
33jar xvf common29571apidef.zip
elinuxhenrikc727c842022-02-11 08:29:36 +010034
35sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\LocationArea/{s/^\( *\).*/ \1/;x;d;}' TS29122_CommonData.yaml >temp.yaml
36mv temp.yaml TS29122_CommonData.yaml
37sed -e 'H;x;/^\( *\)\n\1/{s/\n.*//;x;d;}' -e 's/.*//;x;/\DddTrafficDescriptor/{s/^\( *\).*/ \1/;x;d;}' TS29571_CommonData.yaml >temp.yaml
38mv temp.yaml TS29571_CommonData.yaml
39sed '/accessTokenError.*/,+3d' TS29571_CommonData.yaml >temp.yaml
40mv temp.yaml TS29571_CommonData.yaml
41sed '/accessTokenRequest.*/,+3d' TS29571_CommonData.yaml >temp.yaml
42mv temp.yaml TS29571_CommonData.yaml
elinuxhenrik667fbf32022-02-18 11:10:07 +010043sed '/oneOf.*/,+2d' TS29222_CAPIF_Publish_Service_API.yaml >temp.yaml
44mv temp.yaml TS29222_CAPIF_Publish_Service_API.yaml
elinuxhenrikc727c842022-02-11 08:29:36 +010045
46cd $cwd
47
48oapi-codegen --config internal/readonly/common/generator_settings.yaml internal/readonly/api/TS29122_CommonData.yaml
49oapi-codegen --config internal/readonly/common29571/generator_settings.yaml internal/readonly/api/TS29571_CommonData.yaml
elinuxhenrikd1cc5712022-02-17 14:50:50 +010050oapi-codegen --config internal/readonly/publishserviceapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_Publish_Service_API.yaml
51oapi-codegen --config internal/readonly/publishserviceapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_Publish_Service_API.yaml
52oapi-codegen --config internal/readonly/invokermanagementapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_API_Invoker_Management_API.yaml
53oapi-codegen --config internal/readonly/invokermanagementapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_API_Invoker_Management_API.yaml
54oapi-codegen --config internal/readonly/providermanagementapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_API_Provider_Management_API.yaml
elinuxhenrikc9e4b972022-02-18 16:42:05 +010055oapi-codegen --config internal/readonly/providermanagementapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_API_Provider_Management_API.yaml
56oapi-codegen --config internal/readonly/discoverserviceapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_Discover_Service_API.yaml
elinuxhenrikd6134d52022-03-08 16:05:44 +010057oapi-codegen --config internal/readonly/discoverserviceapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_Discover_Service_API.yaml
elinuxhenrik76aff482022-03-16 10:28:44 +010058oapi-codegen --config internal/readonly/securityapi/generator_settings_types.yaml internal/readonly/api/TS29222_CAPIF_Security_API.yaml
59oapi-codegen --config internal/readonly/securityapi/generator_settings_server.yaml internal/readonly/api/TS29222_CAPIF_Security_API.yaml
elinuxhenrikd6134d52022-03-08 16:05:44 +010060
61go generate ./...