# Upgrade swagger from 2.0 to swagger/openapi 3.0

**URL:** <https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883>\
**Category:** Development\
**Created:** [October 23, 2024, 11:35am UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883 "2024-10-23T11:35:34Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [October 29, 2024, 12:00pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/21 "2024-10-29T12:00:21Z")

</div>

I am compiling on command line and here are the logs: [danielkayiwa@Daniels-MBP idgen % mvn clean install[INFO] Scanning for projects - Pastebin.com](https://pastebin.com/MF5WtLp8)

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [October 29, 2024, 12:18pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/22 "2024-10-29T12:18:04Z")

</div>

just add a reference omod-1.8 inside omod/pom.xml as seen below

```auto
		<dependency>
			<groupId>org.openmrs.module</groupId>
			<artifactId>webservices.rest-omod-1.8</artifactId>
			<version>${WEBSERVICES_VERSION}</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>org.openmrs.module</groupId>
			<artifactId>webservices.rest-omod-1.8</artifactId>
			<version>${WEBSERVICES_VERSION}</version>
			<classifier>tests</classifier>
			<scope>test</scope>
		</dependency>

```

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [October 29, 2024, 12:24pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/23 "2024-10-29T12:24:16Z")

</div>

Shouldn’t you be doing that in the pull request. 😄

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [October 29, 2024, 12:40pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/24 "2024-10-29T12:40:44Z")

</div>

Yeah sure 😀😀😀. I just didnt commit the change.

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [October 29, 2024, 12:58pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/25 "2024-10-29T12:58:31Z")

</div>

Ping me to test again after you have committed it.

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [October 29, 2024, 1:15pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/26 "2024-10-29T13:15:52Z")

</div>

i have made the commit.

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [October 29, 2024, 1:30pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/27 "2024-10-29T13:30:47Z")

</div>

Your commit still has some compiler errors on running mvn clean install

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [October 29, 2024, 1:36pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/28 "2024-10-29T13:36:41Z")

</div>

True, some tests are failing that i will look into after fixing the failing test on rest module PR but what i did is i just went ahead and skipped the tests and used the omod to test and confirm generation of swagger documentation for the idgen module.

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [October 30, 2024, 7:49am UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/29 "2024-10-30T07:49:15Z")

</div>

I have made a fix for the test that was failing on [RESTWS-958: Upgrade swagger to 2.2.23 by mherman22 · Pull Request #631 · openmrs/openmrs-module-webservices.rest · GitHub](https://github.com/openmrs/openmrs-module-webservices.rest/pull/631) and it is ready for review.

I have tested exactky how @dkayiwa advised (simpler than the sdk 🙂 ), by running `mvn jetty:run` in the openmrs-score/webapp and adding the legacy ui, the rest module with changes in that PR.

I also added the omods below that have the updated swagger changes.

- [queue-2.5.0-SNAPSHOT.omod](https://talk.openmrs.org/uploads/short-url/hBPh5DF6W5BXZbGyDJ0p9a7fSct.omod) (199.8 KB)
- [patientflags-3.0.9-SNAPSHOT.omod](https://talk.openmrs.org/uploads/short-url/usQxAzoqfTEsFC0veJDM88tTt0W.omod) (886.7 KB)
- [openconceptlab-2.5.0-SNAPSHOT.omod](https://talk.openmrs.org/uploads/short-url/mrSDKQiE5gaEjcKCIoOV4YEqWi2.omod) (2.3 MB)
- [attachments-3.5.0-SNAPSHOT.omod](https://talk.openmrs.org/uploads/short-url/kSXFNiEavzt4yJ0I8zEPfvx06ZB.omod) (173.8 KB)
- [idgen-4.14.0-SNAPSHOT.omod](https://talk.openmrs.org/uploads/short-url/cpFb98qIKvriZwjvngaM24IIJW.omod) (1.4 MB)

**screenshot of how that looks now**

 ![Screenshot 2024-10-29 at 14-49-24 OpenMRS](https://talk.openmrs.org/uploads/default/original/3X/1/7/17d67958dbe2636a0687a9d6bd7a7fd76a4382b3.png)

cc: @ibacher @dkayiwa

---

<div class="post-metadata">

**Author:** ![dkayiwa](https://talk.openmrs.org/user_avatar/talk.openmrs.org/dkayiwa/32/179_2.png) [@dkayiwa](https://talk.openmrs.org/u/dkayiwa)\
**Post date:** [October 30, 2024, 9:40am UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/30 "2024-10-30T09:40:10Z")

</div>

So, you no longer have runtime errors. Correct?

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [October 30, 2024, 2:22pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/31 "2024-10-30T14:22:13Z")

</div>

On the rest module yes.

I am now working on the idgen module to fix its failing tests.

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [November 6, 2024, 6:03am UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/32 "2024-11-06T06:03:51Z")

</div>

Hey @dkayiwa I am having some persistent test errors on the idgen module especially this class here [openmrs-module-idgen/api/src/test/java/org/openmrs/module/idgen/service/IdentifierSourceServiceTest.java at master · openmrs/openmrs-module-idgen · GitHub](https://github.com/openmrs/openmrs-module-idgen/blob/master/api/src/test/java/org/openmrs/module/idgen/service/IdentifierSourceServiceTest.java) which passes on Platform v1.10.2 but is failing on v2.0.0 and the culprit is the underlying spring version (4.1.4-release)'s handling of transactions and concurrency.

This is the commit I made [(Chore): Upgrade OpenMRS Platform version to 2.x from 1.x](https://github.com/openmrs/openmrs-module-idgen/pull/125/commits/6cab7fe8989ae432fd5c690c322e1dbc091aa7e9) that does the upgrading. The failing tests are those I have annotated with **@Ignore** for now.

Any pointers?

---

<div class="post-metadata">

**Author:** ![ibacher](https://talk.openmrs.org/user_avatar/talk.openmrs.org/ibacher/32/19751_2.png) [@ibacher](https://talk.openmrs.org/u/ibacher)\
**Post date:** [November 6, 2024, 2:24pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/33 "2024-11-06T14:24:22Z")

</div>

Just a note that changing the minimum platform version required for a module is always a breaking change…

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [November 13, 2024, 3:42pm UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/34 "2024-11-13T15:42:38Z")

</div>

i have done most of the necessary changes in the modules and all works just fine with the changes referencing what we have at [RESTWS-958: Upgrade swagger to 2.2.23 by mherman22 · Pull Request #631 · openmrs/openmrs-module-webservices.rest · GitHub](https://github.com/openmrs/openmrs-module-webservices.rest/pull/631).

The following are the modules have all been fixed and most of them were throwing an [InvalidActivationKeyException (OpenMRS 2.7.0-SNAPSHOT API)](https://docs.openmrs.org/doc/org/openmrs/api/InvalidActivationKeyException.html) which i fexd by properly reorganizing the dependencies and how they are being managed within those modules.

- [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #35 · openmrs/openmrs-module-cohort · GitHub](https://github.com/openmrs/openmrs-module-cohort/pull/35)
- [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #68 · openmrs/openmrs-module-attachments · GitHub](https://github.com/openmrs/openmrs-module-attachments/pull/68)
- [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #108 · openmrs/openmrs-module-openconceptlab · GitHub](https://github.com/openmrs/openmrs-module-openconceptlab/pull/108)
- [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #99 · openmrs/openmrs-module-patientflags · GitHub](https://github.com/openmrs/openmrs-module-patientflags/pull/99)
- [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #63 · openmrs/openmrs-module-metadatamapping · GitHub](https://github.com/openmrs/openmrs-module-metadatamapping/pull/63)
- [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #78 · openmrs/openmrs-module-queue · GitHub](https://github.com/openmrs/openmrs-module-queue/pull/78)
- [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #125 · openmrs/openmrs-module-idgen · GitHub](https://github.com/openmrs/openmrs-module-idgen/pull/125)
- [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #9 · openmrs/openmrs-module-ordertemplates · GitHub](https://github.com/openmrs/openmrs-module-ordertemplates/pull/9)

However @dkayiwa @ibacher , i am still having trouble with the idgen module and i would be glad if you had a look at it. Here is the particular class that’s causing headace [RESTWS-958: Ensure the module's rest is updated to use swagger 3.0 by mherman22 · Pull Request #125 · openmrs/openmrs-module-idgen · GitHub](https://github.com/openmrs/openmrs-module-idgen/pull/125/files#diff-4d885d4153e2d95106fafb20a57c4edab7a0f75237fdd9cf4bb306a0ba64ae83).

And feel free to review the rest of the work especially [RESTWS-958: Upgrade swagger to 2.2.23 by mherman22 · Pull Request #631 · openmrs/openmrs-module-webservices.rest · GitHub](https://github.com/openmrs/openmrs-module-webservices.rest/pull/631).

---

<div class="post-metadata">

**Author:** ![mherman22](https://talk.openmrs.org/user_avatar/talk.openmrs.org/mherman22/32/20233_2.png) [@mherman22](https://talk.openmrs.org/u/mherman22)\
**Post date:** [November 20, 2024, 6:14am UTC](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883/35 "2024-11-20T06:14:36Z")

</div>

> [@mherman22](#):
>
> And feel free to review the rest of the work especially [RESTWS-958: Upgrade swagger to 2.2.23 by mherman22 · Pull Request #631 · openmrs/openmrs-module-webservices.rest · GitHub](https://github.com/openmrs/openmrs-module-webservices.rest/pull/631).

@ibacher @dkayiwa when you get time

[Previous page](https://talk.openmrs.org/t/upgrade-swagger-from-2-0-to-swagger-openapi-3-0/43883.md?page=1)
